main.js代码如下:
// The Vue build version to load with the import
command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from ‘vue’
import VueRouter from ‘vue-router’
import Vuex from ‘vuex’
import App from ‘./App’
import routes from ‘./router’
import VueResource from ‘vue-resource’
Vue.use(VueResource) Vue.use(Vuex) Vue.use(VueRouter)
const router = new VueRouter({ routes })
Vue.config.productionTip = false
/* eslint-disable no-new */ new Vue({ el: ‘#app’, router, template: ‘<App/>’, components: { App } })
组件内使用<router-link>报错 vue.esm.js?3e04:558 [Vue warn]: Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the “name” option. (found in <HeaderTop> at D:\my_fe\vue-cli-demo3\vue-cli-demo\src\components\header.vue)
组件内使用vuex报错 secondstep.vue?9570:19Uncaught ReferenceError: Vuex is not defined(…)
组件内再单独调用一次则不报错