1.利用vue腳手架工具創建vue,webpack工程目錄
npm install -g vue-cli 安裝vue腳手架
vue init webpack sell 初始化一個webpack模板,工程名是sell的項目
cd sell 進入項目
npm install 安裝項目package.json配置文件中需要的依賴包
npm run dev


2.vue入口html--index.html;js---main.js
在vue的初始階段,遇到的一些問題
(1)
報錯:ESLint: Do not use 'new' for side effects. (no-new) ESLink是檢查代碼一致性和錯誤的工具,解決以上報錯可以修改ESLink配置,或者解決:解決:
解決: 1,添加/* eslint-disable no-new */注釋,ESLink會繞過檢查
2,使用let將new后的實例給一個變量,符合檢查,不再報錯‘
(2)
報錯:You are running Vue in development mode.Make sure to turn on production mode when deploying for production. See more tips at https://vuejs.org/guide/deployment.html
解決:Vue.config.productionTip = true
(3)
報錯:Do not mount Vue to <html> or <body> - mount to normal elements instead.
解決:new實例的vue對象,el的dom節點會被template模板替換,所以當節點是body or html時候,會發生報錯(可認為html,body是dom不可少的節點,,so...)
(4)
報錯:Unhandled rejection RangeError: Maximum call stack size exceededill install loadIdealTree
解決:npm版本兼容問題,要不降版本,本媛覺得麻煩,直接cnpm install搞定
(5)
報錯:!!vue-stylus-loader!css-loader?{"sourceMap":true}!../node_modules/_vue-loade....
解決:great solution:https://github.com/vuejs/vue-loader/issues/415
(6)
報錯:關於eslink檢查的報錯
解決:自定義eslink檢查規則,例如強制分號的檢查等
(7)
報錯:Cannot find module 'stylus'
解決:依賴中缺少stylus的引入,在package中添加style-stylus,stylus,執行npm install;
Cannot find module ...之類的問題可同類解決
(8)
報錯:router.map is not a function
解決:vue2.0兼容問題,router的map方法,只支持vue1.0版本
1.降低vue版本(不可取)
2.兼容2.0版本寫法
(9)
報錯:router.start is not a function
解決:vue2.0兼容問題,該方法在2.0已經棄用
(10)
報錯:Failed to resolve directive: link
解決:vue2.0兼容問題,v-link方法在2.0已經棄用,使用router-link
(11)
報錯:Unknown custom element: <route-view> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
解決:搜了好多東西,確認vue引入,組件已經注冊,浪費了好多時間,so...route-view寫錯,哎.......論避免低級的錯誤如何主要
(12)
報錯:當報錯解決之后,發現router-view沒有顯示,查看元素沒有渲染dom
解決:new Router({})中,實例化目標格式錯誤,routes Not routers
(13)
報錯: 路徑的引入容易導致錯誤,我們可以通過定義路徑別名解決


