diff --git a/miniprogram/pages/components/popup-plugin/popup-plugin.ts b/miniprogram/pages/components/popup-plugin/popup-plugin.ts index 181b31b..ff3abbe 100644 --- a/miniprogram/pages/components/popup-plugin/popup-plugin.ts +++ b/miniprogram/pages/components/popup-plugin/popup-plugin.ts @@ -18,10 +18,8 @@ Component({ */ methods: { onVisibleChange(e: any) { - console.log(e.detail.visible); - this.setData({ - open: e.detail.visible, - }); + // console.log(e.detail.visible); + this.setData({ open: e.detail.visible }); if (!e.detail.visible) { this.triggerEvent("close"); } diff --git a/miniprogram/pages/components/popup-plugin/popup-plugin.wxml b/miniprogram/pages/components/popup-plugin/popup-plugin.wxml index f368c6d..d0246b7 100644 --- a/miniprogram/pages/components/popup-plugin/popup-plugin.wxml +++ b/miniprogram/pages/components/popup-plugin/popup-plugin.wxml @@ -1,8 +1,14 @@ - - - {{title}} - - - - + + + {{title}} + + + + + diff --git a/miniprogram/pages/components/search-popup/search-popup.json b/miniprogram/pages/components/search-popup/search-popup.json new file mode 100644 index 0000000..95ce7c3 --- /dev/null +++ b/miniprogram/pages/components/search-popup/search-popup.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "popup-plugin": "/pages/components/popup-plugin/popup-plugin", + "t-input": "tdesign-miniprogram/input/input" + } +} diff --git a/miniprogram/pages/components/search-popup/search-popup.ts b/miniprogram/pages/components/search-popup/search-popup.ts new file mode 100644 index 0000000..193be5b --- /dev/null +++ b/miniprogram/pages/components/search-popup/search-popup.ts @@ -0,0 +1,79 @@ +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"); + }, + }, +}); diff --git a/miniprogram/pages/components/search-popup/search-popup.wxml b/miniprogram/pages/components/search-popup/search-popup.wxml new file mode 100644 index 0000000..7c97083 --- /dev/null +++ b/miniprogram/pages/components/search-popup/search-popup.wxml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + 筛选 + + + + + + + + 搜索 + + + + diff --git a/miniprogram/pages/components/search-popup/search-popup.wxss b/miniprogram/pages/components/search-popup/search-popup.wxss new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/miniprogram/pages/components/search-popup/search-popup.wxss @@ -0,0 +1 @@ +