我是初学者。我使用vue cli。这是我的代码。
App.vue:
<template>
<div id="App">
<Count/>
</div>
</template>
<script>
import Count from './components/Count';
export default {
name:'App',
components:{
Count
}
};
</script>
Count.vue:
<template>
<div id="App">
<button @click="increase">{{count}}</button>
</div>
</template>
<script>
import {store} from './store/store.js';
export default {
name:'App',
computed:{
count(){
return store.state.count;
}
},
methods:{
increase(){
store.state.count++;
}
}
};
</script>
main.js:
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App)
}).$mount('#app')
当我运行服务时,编译失败,并说找不到模块:错误:无法解析“ ./store/store.js”。
我需要有人来帮助我。
抱歉。我发现错误,这是由于我的粗心。我导入具有错误路径的组件。