37 lines
934 B
JavaScript
37 lines
934 B
JavaScript
Component({
|
|
properties: {
|
|
brand: { type: Object, value: {} },
|
|
presentation: { type: Object, value: {} },
|
|
offerings: { type: Array, value: [] },
|
|
},
|
|
data: { query: "", visibleOfferings: [] },
|
|
observers: {
|
|
"offerings, query"(offerings, query) {
|
|
const keyword = String(query || "")
|
|
.trim()
|
|
.toLowerCase();
|
|
this.setData({
|
|
visibleOfferings: (offerings || []).filter((item) => {
|
|
if (!keyword) return true;
|
|
return [item.name, item.desc, ...(item.keywords || [])].some((value) =>
|
|
String(value || "")
|
|
.toLowerCase()
|
|
.includes(keyword),
|
|
);
|
|
}),
|
|
});
|
|
},
|
|
},
|
|
methods: {
|
|
search(e) {
|
|
this.setData({ query: e.detail.value });
|
|
},
|
|
open(e) {
|
|
this.triggerEvent("open", { id: e.currentTarget.dataset.id });
|
|
},
|
|
inquire() {
|
|
this.triggerEvent("inquire");
|
|
},
|
|
},
|
|
});
|