vue-monaco icon indicating copy to clipboard operation
vue-monaco copied to clipboard

does it works well with vue3?

Open bokeer opened this issue 4 years ago • 4 comments
trafficstars

Uncaught TypeError: h is not a function

bokeer avatar Jan 17 '21 03:01 bokeer

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.

mustafam-globant avatar Feb 08 '21 17:02 mustafam-globant

Yes, you just have to write this line under MonacoEditor import:

MonacoEditor.render = () => h('div')

Ph0enixKM avatar Apr 02 '21 21:04 Ph0enixKM

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') } }

IOSDongba avatar Apr 16 '21 07:04 IOSDongba

import MonacoEditor from 'vue-monaco'
import { h } from 'vue'
MonacoEditor.render = () => h('div')

mike-seekwell avatar Aug 31 '21 13:08 mike-seekwell