searchBox.js
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use strict";
var common_vendor = require("../common/vendor.js");
const _sfc_main = {
props: {
disabled: {
type: Boolean,
default: true
},
keyWord: {
type: String,
default: ""
}
},
emits: ["doSearchs", "input"],
setup(__props, { emit }) {
const props = __props;
let inputText = common_vendor.ref("");
common_vendor.onMounted(() => {
inputText.value = props.keyWord;
});
const doSearchs = (e) => {
if (e == 0) {
if (inputText.value.trim() == "")
return;
emit("doSearchs", inputText.value);
} else {
emit("doSearchs", e.detail.value);
}
};
const input = (e) => {
if (e.detail.value == "") {
emit("input", e.detail.value);
}
};
const jump = () => {
props.disabled ? common_vendor.index.navigateTo({ url: "/pages/index/search" }) : "";
};
return (_ctx, _cache) => {
return {
a: __props.disabled,
b: common_vendor.o(doSearchs),
c: common_vendor.o([($event) => common_vendor.isRef(inputText) ? inputText.value = $event.detail.value : inputText = $event.detail.value, input]),
d: common_vendor.unref(inputText),
e: common_vendor.o(($event) => doSearchs(0)),
f: common_vendor.o(jump)
};
};
}
};
var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/componets/searchBox.vue"]]);
wx.createComponent(Component);