40 lines
683 B
TypeScript
40 lines
683 B
TypeScript
|
|
import { getDataSet } from '@/utils/util';
|
||
|
|
|
||
|
|
Component({
|
||
|
|
/**
|
||
|
|
* 组件的属性列表
|
||
|
|
*/
|
||
|
|
properties: {
|
||
|
|
options: Array,
|
||
|
|
value: null,
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 组件的初始数据
|
||
|
|
*/
|
||
|
|
data: {
|
||
|
|
visible: false,
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 组件的方法列表
|
||
|
|
*/
|
||
|
|
methods: {
|
||
|
|
open() {
|
||
|
|
this.setData({ visible: true });
|
||
|
|
},
|
||
|
|
onClose() {
|
||
|
|
this.setData({ visible: false });
|
||
|
|
},
|
||
|
|
select(e: any) {
|
||
|
|
const dataset = getDataSet(e);
|
||
|
|
const index = dataset.index;
|
||
|
|
const item = this.data.options[index];
|
||
|
|
const order = dataset.order;
|
||
|
|
|
||
|
|
this.triggerEvent('ok', { value: item.value + ' ' + order });
|
||
|
|
this.onClose();
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|