У меня есть функция внутри моего Component_1 :
methods: {
interactBoxToggel () {
let page = this.$refs.Home.nativeView;
let interactBox = page.getViewById( 'interactBox' );
console.log( interactBox );
}
} ,
mounted () {
bus.$on( 'interactBoxToggel' , this.interactBoxToggel )
}
Это всегда работает, если оно сработало изнутри Component_1 ,
Теперь я портирую его на Component_2 :
methods: {
buttonCotrol( buttonName ) {
bus.$emit( 'interactBoxToggel' );
console.log(buttonName);
}
}
Это тоже работает, но если я выхожу из приложения, «проведите пальцем, чтобы закрыть» ( Android 9 FullscreenЖест ) и снова вернитесь в приложение и вызовите его изнутри Component_2 , я получу ошибку:
System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onTouch failed
System.err: TypeError: Cannot read property 'nativeView' of undefined
System.err:
...
Почему это происходит? Как я могу решить это?