<el-input v-model="searchVal" style="width:100%; margin-bottom:10px" placeholder="请输入内容"/>
data(){
searchVal: '',
items: [
{
'tenantId': 36045,
'orgId': 3604500002,
'orgName': '开发环境测试-1',
'type': null,
'activate': '1'
},
{
'tenantId': 36053,
'orgId': 3605300001,
'orgName': '52-测试账号(校区)',
'type': null,
'activate': '1'
},
{
'tenantId': 36053,
'orgId': 3605300008,
'orgName': '测试-大爷',
'type': null,
'activate': '1'
}
],
}
<div class="serchArea">
<ul>
<p>总部</p>
<el-radio-group v-model="radio1" >
<el-radio v-for="(item,index) in search " :key="'z'+index" :label="item.orgName" @change="online(item)"/>
</el-radio-group>
<p>校区</p>
<el-radio-group v-model="radio1" >
<el-radio v-for="(item,index) in search " :key="'x'+index" :label="item.orgId" @change="online(item)"/>
</el-radio-group>
</ul>
</div>
computed: {
search() {
var item = this.items.filter(ele => {
if (ele.orgName.match(this.searchVal)) {
return ele
}
})
return item
}
}
话不多讲,有这三块代码就够了。