weex+vue-router填坑

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)
})
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容