template里代码段:
<div class="search-info">
<el-input type="text" auto-complete="off" placeholder="请输入GroupName" v-model="searchVal"
class="input"
@focus="searchInput"></el-input>
<el-button class="small-edit fl" @click="searchApp"> 搜索 </el-button>
</div>
script 里的代码段:
export default{
data(){
datas: [], //所有数据
viewData: [], // 展示的数据
searchVal: ''
},
created (){
this.getData()
}
methods: {
getData: function (){ //获取接口数据,渲染到页面表格
},
searchApp: function (){
let self = this
let dataList = [] //符合查找的数据
this.datas.forEach( function (element) {
if(element.name.indexOf(self.searchVal) !== -1) {