一、首先安裝一款可以快速顯示項目中使用的依賴的版本插件。
npm install -g npm-check-updates
二、這樣就可以快速顯示插件版本了:npm-check-updates,可以使用縮寫ncu
ncu
三、卸載舊版Element-ui
npm uninstall element-ui
四、安裝新版本。
npm i [email protected] -S
注意@前後沒有空格。
如果是1.x版本升級到2.x的版本,還需要重新修改一下main.js中的引用路徑。
1.將import 'element-ui/lib/theme-default/index.css’替換爲import ‘element-ui/lib/theme-chalk/index.css’
2.在.babelrc 文件中 theme-default 替換爲 theme-chalk
3.在node_modules\babel-plugin-component\README.md文件中 theme-default 替換爲theme-chalk