发布于 6 年前 作者 awtmeng 7413 次浏览 最后一次编辑是 6 年前 来自 问答
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利

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(…)