Commit 055bd749 by fengweida

勾选框调整变大

搜索框支持空格分隔多个搜索
1 parent 7b85352b
Showing 1 changed file with 27 additions and 11 deletions
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
<div class="row navbar-btn" v-if="allServiceList.length"> <div class="row navbar-btn" v-if="allServiceList.length">
<div class="col-lg-6"> <div class="col-lg-6">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" v-model="searchText" placeholder="Search for..."> <input type="text" class="form-control" v-model="searchText" placeholder="输入搜索内容">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-danger" type="button" @click="cleanSearchText">clean</button> <button class="btn btn-danger" type="button" @click="cleanSearchText">清楚搜索内容</button>
</span> </span>
</div> </div>
</div> </div>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<h3 v-if="!item.isWebService">{{item.serviceName}}</h3> <h3 v-if="!item.isWebService">{{item.serviceName}}</h3>
<h4 v-else>{{item.serviceName}}</h4> <h4 v-else>{{item.serviceName}}</h4>
</td> </td>
<td><input class="form-check-input" type="checkbox" v-model="item.isOpen"/></td> <td><input class="form-check-input" type="checkbox" style="zoom: 230%;" v-model="item.isOpen"/></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -85,14 +85,30 @@ ...@@ -85,14 +85,30 @@
}, },
searchText: function (val) { searchText: function (val) {
//在allServiceList中找到包含val的 //在allServiceList中找到包含val的
let serviceList = []; if (val.indexOf(" ") != -1) {
this.allServiceList.forEach((item) => { let valArr = val.split(" ");
console.log(item) let serviceList = [];
if (item.serviceName.indexOf(val) != -1) { for (let i = 0; i < valArr.length; i++) {
serviceList.push(item); let val = valArr[i];
} this.allServiceList.forEach((item) => {
}); console.log(item)
this.serviceList = serviceList; if (item.serviceName.indexOf(val) != -1) {
serviceList.push(item);
}
});
}
this.serviceList = serviceList;
}else {
let serviceList = [];
this.allServiceList.forEach((item) => {
console.log(item)
if (item.serviceName.indexOf(val) != -1) {
serviceList.push(item);
}
});
this.serviceList = serviceList;
}
} }
}, },
data: { data: {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!