小编Kha*_*ang的帖子

Vue3 父组件调用子组件方法

Vue3无法在父组件中调用子组件方法

在Vue2中,我可以像这样调用子组件方法

this.$root.$refs.ChildComponent.methodName()
Run Code Online (Sandbox Code Playgroud)

但是在Vue3中,我收到这样的错误

runtime-core.esm-bundler.js:218 Uncaught TypeError: Cannot read properties of undefined (reading 'methodName')
Run Code Online (Sandbox Code Playgroud)

vuejs3

11
推荐指数
3
解决办法
2万
查看次数

标签 统计

vuejs3 ×1