该篇继续记录最近项目中一些疑难知识点和坑的解决办法。vue
<router-view :key="key"></router-view>
computed: {
key() {
// 或者 :key="$route.path" 只要保证key惟一就能够了
return this.$route.name !== undefined? this.$route.name + +new Date(): this.$route + +new Date()
}
}
复制代码
<ul class="jcButtonUl">
<li v-for="(item,index) in hostLoginManageButton" :key="index" @click="hostAddManage(index)">
<span :class="item.icon"></span>
{{item.btnValue}}
</li>
</ul>
复制代码
computed:{
hostLoginManageButton(){
let buttonArray=[];
this.hostManageButtonArray.forEach(function(item,index){
if(index!==2 && index!==3 && index!==5){
buttonArray.push(item);
}
});
return buttonArray;
}
}
复制代码
解决。bash
<el-table ref="jcqtTable" v-loading="loading" :data="tableData" tooltip-effect="dark" stripe style="width: 100%" @select="handleSelect" @selection-change="handleSelect" @select-all="handleSelect">
<el-table-column type="selection" width="55"></el-table-column>
省略
</el-table>
复制代码
computed: {
tableData() {
return this.jcqtTableCon.slice((this.currentPage-1)*this.pageSize, this.currentPage*this.pageSize)
}
}
复制代码
watch:{
textInput:function(val){
//操做
}
}
复制代码
若是是监听某一对象里的某一项值的变化该如何作呢?往下看ui
data(){
return {
obj:{
textInput:''
}
}
},
watch:{
'obj.textInput':function(val){
//操做
}
}
复制代码
项目没有作完目前,陆续更新中。this