Files
FreeERP.Applet/miniprogram/pages/components/search-popup/search-popup.ts

80 lines
1.4 KiB
TypeScript
Raw Normal View History

Component({
options: { multipleSlots: true },
/**
*
*/
properties: {
useFooterSlot: {
type: Boolean,
},
dataKey: {
type: String,
},
placeholder: {
type: String,
},
value: null,
hideMore: {
type: Boolean,
},
hideInput: {
type: Boolean,
},
customStyle: {
type: String,
value: "",
},
useInputSlot: {
type: Boolean,
},
},
/**
*
*/
data: {
show: false,
},
/**
*
*/
methods: {
showSearch() {
this.setData({ show: true });
this.triggerEvent("showChange", true);
},
close() {
this.setData({ show: false });
this.triggerEvent("showChange", false);
},
ok() {
this.setData({ show: false });
this.triggerEvent("showChange", false);
this.triggerEvent("ok");
},
change(e: any) {
this.triggerEvent("change", e.detail);
},
scanCode() {
const _this = this;
wx.scanCode({
onlyFromCamera: true,
scanType: ["qrCode"],
success: (res) => {
const qrcode = res.result || "";
_this.triggerEvent("change", { value: qrcode });
_this.triggerEvent("ok");
},
});
},
search() {
this.triggerEvent("ok");
},
clear() {
this.triggerEvent("change", { value: "" });
this.triggerEvent("ok");
},
},
});