let b = this.$refs[this.userRef].$children[0].$children[2].$children[1].$children[0].$children[0]
console.info('resetting' in b );
b.resetting();
我这里是这样,但是觉得很不合理,有没有api有说明能访问更深层级的子组件呢?
let b = this.$refs[this.userRef].$children[0].$children[2].$children[1].$children[0].$children[0]
console.info('resetting' in b );
b.resetting();
我这里是这样,但是觉得很不合理,有没有api有说明能访问更深层级的子组件呢?
你倒是可以这样写啊:
created () {
window.myComponent = this;
}
window.myComponent&&window.myComponent.resetting&&window.myComponent.resetting()
13 回答12.9k 阅读
7 回答2.1k 阅读
3 回答1.3k 阅读✓ 已解决
2 回答1.3k 阅读✓ 已解决
6 回答942 阅读✓ 已解决
6 回答1.1k 阅读
2 回答1.3k 阅读✓ 已解决
感觉没有啥很好的方法直接访问到
不能直接在子组件上加引用么?