this.$refs.permissionModal.childMethods() ERROR: Object is of type 'unknown'.
嘗試解決成功的一種方法:
在子組件的生命周期函數中
mounted() { //將this拋給父組件,讓父組件能夠調用本組件的方法 this.$emit('childThis', this) },
在父組件中
<template> <Child @childThis="childThisReceive"/> </template>
childThisReceive(childThis: any) { this.childThis = childThis },
用這種方式調用
this.childThis.childMethodsXXX()