添加组件
This commit is contained in:
39
miniprogram/pages/components/sort-plugin/sort-plugin.ts
Normal file
39
miniprogram/pages/components/sort-plugin/sort-plugin.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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();
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user