获取el-tree的选择节点, 希望可以动态显示选中的个数, 因此使用了computed, 却发现computed生命周期在refs前面, 有其他方法可以实现这一功能吗?
checkedList: function(ev) {
return this.$refs.clearserver ? this.$refs.clearserver.getCheckedKeys().filter(item => {
return this.agentTreeId.indexOf(item) < 0;
}) : "";
}
computed没有生命周期,什么时候调用就什么时候运行
要么你在树初始化完成后再调用,要么自己监听选中事件