- // 用户搜索内容
- let val = ref("");
"val" type="text" placeholder="请输入行业/公司/名称"/>
- let data = reactive({
- arrs: [],
- });
- // 模糊查询事件
- const onSearch = () => {
- let datas = [];
- for (let i = 0; i < data.arrs.length; i++) {
- data.arrs[i].content = data.arrs[i].content || "";
- data.arrs[i].title = data.arrs[i].title || "";
- if (
- data.arrs[i].content.indexOf(val.value) > -1 ||
- data.arrs[i].title.indexOf(val.value) > -1
- ) {
- datas.push(data.arrs[i]);
- }
- }
- data.goods = datas;
- console.log(data.goods);
- // val.value = "";
- };
原创作者:吴小糖
创作时间:2023.10.16