vue-monaco
vue-monaco copied to clipboard
does it works well with vue3?
Uncaught TypeError: h is not a function
From Docs- In 3.x, h is now globally imported instead of being automatically passed as an argument. https://v3.vuejs.org/guide/migration/render-function-api.html#render-function-argument
Implementing this in MonacoEditor.js solved the issue for me.
Yes, you just have to write this line under MonacoEditor import:
MonacoEditor.render = () => h('div')
2.x语法 在2.x中,该render函数将自动接收该h函数(这是的常规别名createElement)作为参数:
// Vue 2 Render Function Example export default { render(h) { return h('div') } } #3.x语法 在3.x中,h现在已全局导入,而不是自动作为参数传递。
// Vue 3 Render Function Example import { h } from 'vue'
export default { render() { return h('div') } }
import MonacoEditor from 'vue-monaco'
import { h } from 'vue'
MonacoEditor.render = () => h('div')