// 下拉框数据去重
// var tempData = res.data.totalList.rows
// console.log(tempData,'tempData')
// var hash = {}
// tempData = tempData.reduce(function(item, index) {
// hash[index.parentname]
// ? ""
// : (hash[index.parentname] = true && item.push(index))
// return item
// }, [])
// // 把后端返回的空值过滤
// this.productNameList = tempData.filter(r => {
// return r.parentname
// })
<div
class="spray-search-name-single "
v-for="(item, index) in nameData"
:key="item.id"
:id="'nav' + index"
v-trigger
:class="query.parentid == item.deviceId ? 'aa' : 'active'"
@click="changeTransmissionByPile(item.deviceId)"
>
methods平级 // 自定义指令 默认是第一个选中
directives: {
trigger: {
inserted(el, binging) {
el.id == "nav0" ? el.click() : null
}
}
},
<el-tabs v-model="queryParams.queryParam" @tab-click="handleClick">
handleClick(tab, event) {
// tabs切换把数据置空
this.queryParams.statustypeid = ""
this.queryParams.onlineStatus = ""
},