1. 怎樣創建和vue-cli一樣擁有入口文件main.js
解決方案:
第一步:在src文件中創建main.js文件
在src文件中創建main.js文件
第二步:在webpack.comfig.js文件中entry和weexEntry配置入口文件的地址
webpack.comfig.js配置入口文件
2.控制臺報Unknown custom element: <router-view> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
image.png
解決方案:
因為你入口文件main.js中重復引用了vue,將import Vue from 'vue'刪除即可,刪除后的main.js文件
// main.js import App from './App.vue' import router from './router' import Vue from 'vue' new Vue({ el:'#root', router, render:create => create(App) })