page-meta.uvue 1.5 KB
Newer Older
Anne_LXM's avatar
Anne_LXM 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
<template>
  <page-meta
    :background-text-style="bgTextStyle"
    :background-color="bgColor"
    :background-color-top="bgColorTop"
    :background-color-bottom="bgColorBottom"
    :scroll-top="scrollTop"
    :scroll-duration="2000"
    @scroll="scroll"
    @scrolldone="scrolldone"
    page-style="color: green"
    root-font-size="30px"
  >
    <navigation-bar
      :title="nbTitle"
      :loading="nbLoading"
      :front-color="nbFrontColor"
      :background-color="nbBackgroundColor"
    />
  </page-meta>
  <view class="content">
    <text class="title">页面内容</text>
    <button @click="scrollTo">点击跳到 300px 处</button>
    <view class="uni-list" v-for="(_, index) in 30" :key="index">
      <view class="uni-list-cell">{{ index }}</view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        bgTextStyle: 'dark',
        scrollTop: '0px',
        bgColor: '#ff0000',
        bgColorTop: '#00ff00',
        bgColorBottom: '#0000ff',
        nbTitle: '标题',
        nbLoading: false,
        nbFrontColor: '#ffffff',
        nbBackgroundColor: '#00aaff',
        // 自动化测试
        scrollType:null,
        scrolldoneType:null,
      }
    },
    onLoad() {
      setTimeout(()=>{
        this.nbLoading = true
      },2000)
    },
    methods: {
      scrollTo(){
        this.scrollTop = '300px'
      },
      scroll(e){
        this.scrollType=e.type
      },
      scrolldone(e){
        this.scrolldoneType=e.type
      }
    }
  }
</script>