问题
I have this declaration of editor
in component vue file:
export default {
data: function() {
return {
editor: new Editor({
doc: this.value,
vueInstance: this,
}),
}
},
I am using editor.doc
for generating template within contenteditable.
After each keydown event editor.doc
should be changed and template should be updated. It means I need change editor.doc
kepping reactivity within Editor()
external script like this:
vueInstance.$set(this.doc, someKey, someValue);
. That is why I pass vueInstance: this
to Editor()
. But I get error after doing this.
I get these errors in google chrome :
Uncaught RangeError: Maximum call stack size exceeded
TypeError: "t is undefined"
and I get these errors in firefox:
[Vue warn]: Error in nextTick: "TypeError: t is undefined"
TypeError: "t is undefined"
How to properly modify editor.doc
keeping reactivity? How to pass vue instance to external script if I need so?
来源:https://stackoverflow.com/questions/60727977/how-to-pass-vue-instance-to-external-script