vuex。未找到模块

问题描述 投票:0回答:1

我是初学者vue。我使用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.js'。无法解析'.store.js'。.

我需要有人来帮助我。

vue.js vuex
1个回答
0
投票

对不起,我发现错误。我发现了错误,这是我的粗心造成的,我用错误的路径导入组件。

© www.soinside.com 2019 - 2024. All rights reserved.