hifarer / vueditor

A wysiwyg editor written in Vue.js and Vuex.js
http://hifarer.github.io/vueditor/
MIT License
648 stars 112 forks source link

Uncaught Error: [vuex] must call Vue.use(Vuex) #24

Open SaidTayebi opened 7 years ago

SaidTayebi commented 7 years ago

I'm importing Vuex and calling Vue.use(Vuex) but still getting this error

hifarer commented 7 years ago

can you paste your code here? I think this issue has nothing to do with vueditor.

devronhansen commented 6 years ago

I've got the same error.

...
import Vue from "vue"
import Vuex from "vuex"

import actions from "./actions"
import getters from "./getters"
import mutations from "./mutations"
import createPersistedState from "vuex-persistedstate"
import Vueditor from "vueditor"

Vue.use(Vuex)

const store = new Vuex.Store({
    plugins: [createPersistedState()],
    state: {
...
    },
    getters,
    mutations,
    actions,
})

const editorConfig = {
  toolbar: [
    'removeFormat', 'undo', '|', 'elements', 'fontName', 'fontSize', 'foreColor', 'backColor'
  ],
  fontName: [
    { val: 'arial black' },
    { val: 'times new roman' },
    { val: 'Courier New' }
  ],
  fontSize: ['12px', '14px', '16px', '18px', '0.8rem', '1.0rem', '1.2rem', '1.5rem', '2.0rem'],
  uploadUrl: ''
};

Vue.use(Vueditor, editorConfig);
...

Uncaught Error: [vuex] must call Vue.use(Vuex) before creating a store instance.

If i comment out the vueditor part everything works.

Ben-Ben-B commented 6 years ago

+1

Harvey2012 commented 3 years ago

+1