electricity_bill_calc_wx/components/searchSelectWrapper/index.js
2025-03-03 16:54:40 +08:00

48 lines
823 B
JavaScript

// components/searchSelectWrapper/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
label: String,
placeholder: String,
text: String,
fieldType: {
type: String,
value: "text"
},
type: {
type: String,
value: "select"
}
},
/**
* 组件的初始数据
*/
data: {
keyword: "",
text: "",
},
/**
* 组件的方法列表
*/
methods: {
onSearch() {
this.triggerEvent("search")
},
onChangeKeyword(e) {
this.setData({ keyword: e.detail });
},
onChangeText(e) {
this.setData({ text: e.detail });
this.triggerEvent("changeText", e.detail)
},
onSearchKeyword() {
this.triggerEvent("searchKeyword", this.data.keyword)
this.setData({ keyword: "" })
}
}
})