1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| import fmtEvent from "mini-ali-ui/es/_util/fmtEvent"; const noop = function noop() {}; Component({ mixins: [], data: { value:[] }, props: { show:false, animation:true, position:'bottom', zIndex:100, title:'', columns:[], cancelButtonText:'取消', confirmButtonText:'确认', onCancel:noop, onChange:noop, onConfirm:noop, }, didMount() { let t = [] t.length = this.props.columns.length t.fill(0) this.setData({value: t}) }, didUpdate() {}, didUnmount() { }, methods: { onChange(e) { const value = e.detail.value let index = -1 value.forEach((e,idx)=> { if(e!==this.data.value[idx]) index = idx }) this.setData({value:value}) e.detail.picker = this e.detail.index = index const event = fmtEvent(this.props, e); this.props.onChange(event); }, onCancel(e){ const event = fmtEvent(this.props, e); this.props.onCancel(event); }, onConfirm(e){ const value = this.data.value let detail = [] e.detail.value = value value.forEach((e,idx)=> { detail.push(this.props.columns[idx].values[Number(e)]) }) e.detail.detail = detail const event = fmtEvent(this.props, e); this.props.onConfirm(event); },
}, });
|