从we-vue优化的picker, 其参考mint-ui, 所以算是从mint-ui的pick吧~ 改造成支持返回键的picker~
> yarn add vc-popup-picker || npm i vc-popup-picker || cnpm i vc-popup-picker --by=yarn
import Vue from 'vue'
import VcPopupPicker from 'vc-popup-picker'
// 这里名字可以随意
Vue.use(VcPopupPicker)
this.picker = new this.$popup.Picker({
...config
propsData: {}
})
this.picker.open(e, {
...config
propsData: {}
})
this.picker.close()
e为事件Event, 比如click时候取得的evt, 与一些定位方法相关 config可参考popup-base/readme.md
{
e: Object // 从open(e, {})传进来的e
slots: Array,
onChange: Function,
showItemNum: Number,
defaultValues: Array,
showItemHeight: Number,
confirmText: {
type: String,
default: '确定'
},
cancelText: {
type: String,
default: '取消'
},
onConfirm: Function,
onCancel: Function
}
MIT 一起来扣细节~