import { toArray } from '@/utils/util'; Component({ options: { multipleSlots: true }, /** * 组件的属性列表 */ properties: { title: null, options: null, value: null, }, observers: { value: function (value) { const data = toArray(this.data.options).find((el) => el.value == value); this.setData({ note: data?.label || '' }); }, }, /** * 组件的初始数据 */ data: { show: false, note: '', }, /** * 组件的方法列表 */ methods: { onOpenPicker() { this.setData({ show: true }); }, onPickerCancel() { this.setData({ show: false }); }, onConfirm(e: any) { this.triggerEvent('change', { value: e.detail.value?.[0] }); this.onPickerCancel(); }, onClear() { this.triggerEvent('change', { value: '' }); this.onPickerCancel(); }, }, });