Home

Issue: 3082

How to use Vue.extend to inject Vue instance into a component in Nuxt?

[issue link]

I am trying to create a ProseMirror editor with Nuxt.js on which my users can insert certain components into their inline text.

I should be able to render a new component node in NodeView using Vue.extend(). The problem is, my component needs to communicate with this.store,andanewlyinitializedVueinstancedoesnothaveit.Therefore,renderingthecomponentwithanewVueinstancewouldcauseanerrorthatsuggestssomethinglikethis.store, and a newly-initialized Vue instance does not have it. Therefore, rendering the component with a new Vue instance would cause an error that suggests something like `this.store does not exist`.

Is there anyway that I could access the Vue instance created by Nuxt.js and thereby call Vue.extend() to pass the Vuex instance to my component?

Editor.vue: https://github.com/v2land/v2land-frontend/blob/feature/comment-editor/components/Comment/Editor.vue
Event NodeView: https://github.com/v2land/v2land-frontend/blob/feature/comment-editor/components/Comment/View/Event.js

This question is available on Nuxt.js community (#c2668)