大家好,我只是想知道如何从子组件调用 perent 函数我尝试使用 $parent 来调用 perent 方法,但我有这个错误 typeError: _this.$parent.forceRender 不是一个函数,这里是父级我试图调用的方法
methods: {
forceRender() {
this.componentKey += 1
}
},
Run Code Online (Sandbox Code Playgroud)
这是子组件,您可以看到我正在尝试使用 $parent 调用父方法
this.$parent.forceRender()
Run Code Online (Sandbox Code Playgroud)