Why can"t note components be displayed? Several errors have been prompted [vuex] must call Vue.use (Vuex) before creating a store instance.
and store.js prompts "Vue" is defined but never used
main.js also hints " store" is defined but never used
note.vue
<template>
<div>
aaaa
{{msg}}
</div>
</template>
<script>
export default {
name: "note",
data () {
return {
}
},
computed: {
msg () {
return this.$store.state.msg
}
}
}
</script>
<style scoped>
</style>
main.js
import Vue from "vue"
import App from "./App"
import router from "./router"
import Mint from "mint-ui"
import "mint-ui/lib/style.css"
import Vuex from "vuex"
import store from "./store/store.js"
Vue.use(Vuex)
Vue.use(Mint)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: "-sharpapp",
router,
components: { App },
template: "<App/>"
})
router/index.js
import Vue from "vue"
import Router from "vue-router"
import Note from "@/components/Note"
Vue.use(Router)
export default new Router({
routes: [
{
path: "/",
name: "note",
component: Note
}
]
})
APP.vue
<template>
<div id="app">
<router-view/>
</div>
</template>
<script>
export default {
name: "App"
}
</script>
<style>
</style>
store.js
import Vue from "vue"
import Vuex from "vuex"
export default new Vuex.Store({
state: {
msg: "aaa"
},
mutations: {
},
components: {
},
modules: {
},
actions: {
}
})