2026-01-09 15:26:10 +08:00
|
|
|
Component({
|
2026-01-14 16:54:47 +08:00
|
|
|
options: { multipleSlots: true, addGlobalClass: true },
|
2026-01-09 15:26:10 +08:00
|
|
|
/**
|
|
|
|
|
* 组件的属性列表
|
|
|
|
|
*/
|
|
|
|
|
properties: {
|
|
|
|
|
useFooterSlot: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
},
|
|
|
|
|
dataKey: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
placeholder: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
value: null,
|
|
|
|
|
hideMore: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
},
|
|
|
|
|
hideInput: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
},
|
|
|
|
|
customStyle: {
|
|
|
|
|
type: String,
|
2026-01-28 17:18:43 +08:00
|
|
|
value: '',
|
2026-01-09 15:26:10 +08:00
|
|
|
},
|
|
|
|
|
useInputSlot: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 组件的初始数据
|
|
|
|
|
*/
|
|
|
|
|
data: {
|
|
|
|
|
show: false,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 组件的方法列表
|
|
|
|
|
*/
|
|
|
|
|
methods: {
|
|
|
|
|
showSearch() {
|
|
|
|
|
this.setData({ show: true });
|
2026-01-28 17:18:43 +08:00
|
|
|
this.triggerEvent('showChange', true);
|
2026-01-09 15:26:10 +08:00
|
|
|
},
|
|
|
|
|
close() {
|
|
|
|
|
this.setData({ show: false });
|
2026-01-28 17:18:43 +08:00
|
|
|
this.triggerEvent('showChange', false);
|
2026-01-09 15:26:10 +08:00
|
|
|
},
|
|
|
|
|
ok() {
|
|
|
|
|
this.setData({ show: false });
|
2026-01-28 17:18:43 +08:00
|
|
|
this.triggerEvent('showChange', false);
|
|
|
|
|
this.triggerEvent('ok');
|
|
|
|
|
},
|
|
|
|
|
reset() {
|
|
|
|
|
this.setData({ show: false });
|
|
|
|
|
this.triggerEvent('showChange', false);
|
|
|
|
|
this.triggerEvent('reset');
|
2026-01-09 15:26:10 +08:00
|
|
|
},
|
|
|
|
|
change(e: any) {
|
2026-01-28 17:18:43 +08:00
|
|
|
this.triggerEvent('change', e.detail);
|
2026-01-09 15:26:10 +08:00
|
|
|
},
|
|
|
|
|
scanCode() {
|
|
|
|
|
const _this = this;
|
|
|
|
|
wx.scanCode({
|
|
|
|
|
onlyFromCamera: true,
|
2026-01-28 17:18:43 +08:00
|
|
|
scanType: ['qrCode'],
|
2026-01-09 15:26:10 +08:00
|
|
|
success: (res) => {
|
2026-01-28 17:18:43 +08:00
|
|
|
const qrcode = res.result || '';
|
|
|
|
|
_this.triggerEvent('change', { value: qrcode });
|
|
|
|
|
_this.triggerEvent('ok');
|
2026-01-09 15:26:10 +08:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
search() {
|
2026-01-28 17:18:43 +08:00
|
|
|
this.triggerEvent('ok');
|
2026-01-09 15:26:10 +08:00
|
|
|
},
|
|
|
|
|
clear() {
|
2026-01-28 17:18:43 +08:00
|
|
|
this.triggerEvent('change', { value: '' });
|
|
|
|
|
this.triggerEvent('ok');
|
2026-01-09 15:26:10 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|