template-options.uvue 1.1 KB
Newer Older
1 2
<template>
  <view class="page">
3
    <template v-if="dataInfo.isShow">
4 5
      <view class="title">{{ title }}</view>
    </template>
6
    <view class="show-botton" @click="handleShow">{{ dataInfo.isShow ? '点击隐藏' : '点击显示' }}</view>
7 8 9 10 11 12 13
    <template v-for="(item, index) in list" :key="index">
      <view class="item">{{ index + 1 }}.{{ item.name }}</view>
    </template>
    <button @click="goMapStyle">跳转绑定 Map 类型 style 页面</button>
  </view>
</template>

14 15 16 17
<script lang='uts'>
type DataInfo = {
  isShow: boolean
}
18 19 20 21 22 23 24
type objType = {
  name : string
}
export default {
  data() {
    return {
      title: "hello",
25 26 27
      dataInfo: {
        isShow: false,
      } as DataInfo,
28 29 30 31 32 33 34 35 36 37 38
      list: [{
        name: 'foo1'
      },
      {
        name: 'foo2'
      }
      ] as objType[]
    }
  },
  methods: {
    handleShow() {
39
      this.dataInfo.isShow = !this.dataInfo.isShow
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
    },
    goMapStyle() {
      uni.navigateTo({ url: '/pages/built-in/component/template/template-map-style-options' })
    }
  }
}
</script>

<style>
.item {
  display: flex;
  flex-direction: row;
  margin: 15px;
  border: #eee solid 1px;
}
</style>