优化:统一小程序业务引用选择交互
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
Component({
|
||||
properties: {
|
||||
visible: { type: Boolean, value: false },
|
||||
title: { type: String, value: '请选择' },
|
||||
keyword: { type: String, value: '' },
|
||||
placeholder: { type: String, value: '搜索' },
|
||||
items: { type: Array, value: [] },
|
||||
selectedId: { type: null, value: '' },
|
||||
loading: { type: Boolean, value: false },
|
||||
errorText: { type: String, value: '' },
|
||||
emptyText: { type: String, value: '暂无可选内容' },
|
||||
actionText: { type: String, value: '' },
|
||||
showSearch: { type: Boolean, value: true }
|
||||
},
|
||||
|
||||
methods: {
|
||||
close() {
|
||||
this.triggerEvent('close')
|
||||
},
|
||||
|
||||
stopEvent() {
|
||||
},
|
||||
|
||||
onSearch(event) {
|
||||
this.triggerEvent('search', { value: event.detail.value })
|
||||
},
|
||||
|
||||
selectItem(event) {
|
||||
const item = this.data.items[Number(event.currentTarget.dataset.index)]
|
||||
if (item) this.triggerEvent('select', { item })
|
||||
},
|
||||
|
||||
retry() {
|
||||
this.triggerEvent('retry')
|
||||
},
|
||||
|
||||
action() {
|
||||
this.triggerEvent('action')
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user