vue.esm.js?efeb:591 [Vue warn]: Error in event handler for “click”: “TypeError: Cannot read property ‘setCheckedKeys’ of undefined”
This is because this.dialogVisible = true does not update the dom immediately, but waits for the entire logic to be executed and then renders it again, so the popup box is not rendered at this time and does not exist in the dom tree.
This.$refs.tree is undefined so setCheckedKeys must also be undefined.
Solution: Use this.$nextTick(), this.$nextTick() will execute callback after DOM update:
opetation (auth) {
this.dialogVisible = true
this.$nextTick(function() {
this.$refs.tree.setCheckedKeys(auth)
})
}
Read More:
- [Solved] Cannot read property ‘setCheckedKeys‘ of undefined“
- [Solved] Error in v-on handler “TypeError Cannot read properties of undefined (reading ‘resetFields‘)“
- Element El dialog close callback error [How to Solve]
- [Vue warn]: Error in callback for watcher “value“ (How to Solve)
- [Solved] Element form method Error: TypeError: Cannot read properties of undefined (reading ‘resetFields’)
- [Solved] Element form method resetfields() error: vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read properties of undefined (reading ‘indexOf’)
- Parsing error: await is a reserved word [How to Solve]
- How to Solveb Vue3 defineProps Error
- Use of $watch in Vue (solve rangeerror: maximum call stack size exceeded)
- React error boundary (What You Should Know & How to Solve)
- Full screen scrolling by Vue + Vue awesomeswiper
- [Solved] Error in v-on handler: “Error: please transfer a valid prop path to form item
- [Solved] Vue echarts Error: Initialize failed: invalid dom.
- VUE Error: Vue Error in nextTick: “RangeError: Maximum call stack size exceeded“
- [Solved] JS Error: cannot set property xxx of undefined
- [Solved] Echarts Error: Uncaught (in promise) Error: Initialize failed: invalid dom.
- Google browser plug-in JavaScript errors Notifier
- Vue refreshes the current page (no flash screen will appear)
- [Solved] JS Error: Uncaught TypeError: Cannot set properties of null (setting ‘innerHTML‘)
- How to Solve VUE Error: Avoid mutating a prop directly since the value will be overwritten …