123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import { ComponentWithComputed } from 'miniprogram-computed'
- // components/downselect/index.ts
- ComponentWithComputed({
- /**
- * 组件的属性列表
- */
- properties: {
- dateArr:Array,
- current: Object
- },
- /**
- * 组件的初始数据
- */
- data: {
- isShowDown:false
- },
-
- watch: {
- isShowDown: function (isShowDown) {
- this.triggerEvent('isShowDown',{isShowDown:isShowDown}, { bubbles: true, composed: true })
- },
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onTab(){
- this.setData({
- isShowDown: !this.data.isShowDown
- })
- },
- tapItem(e:any){
- let {key} = e.target.dataset
- let item = this.data.dateArr.find((ii:any)=>ii.key == key)
- this.setData({
- current:item,
- isShowDown:false
- })
- this.triggerEvent('currentSelect',{current:this.data.current}, { bubbles: true, composed: true })
- },
- }
- })
|