1.注意updated和computed,
updated只能监测到data中的字段变化触发更新,而组件中的prop属性字段发生变化时,不会触发updated钩子。
computed中的字段,只有在依赖字段发生变化时,才会触发该字段的更新。
data() {
return {
values:[],
selects:[],
sort:{
field:'id',
order:"desc"
}
}
},
computed: {
filter_options:function () {
return this.options
// 只有当options发生变化时,filter_options才会随着更新变化
}
},
updated: {
// 当data中字段(values、select等)发生变化时,会触发当前钩子
}
2.elementUI中 table组件,直接在 列 el-table-column上使用 v-if,会有问题,列的顺序会乱。建议,直接使用两个table。