在element-ui中的表格中使用scope有錯 <template slot-scope="scope">
阿新 • • 發佈:2021-12-12
1、升級element-ui的版本,如果element-ui的版本低於2.5是不支援使用slot-scope="scope">的,
可以去你的package-json中檢視你的element-ui得版本
2、升級element-ui的版本
《1》先解除安裝之前安裝的element-ui版本
npm uninstall element-ui
《2》重新安裝需要的版本
升級到最新版本
npm i element-ui -S
升級到自己想要的版本
npm install element-ui@2.5.4 --save
《3》最後在main.js中把default修改為theme-chalk
import 'element-ui/lib/theme-chalk/index.css';
3、如果升級之後報如下錯誤
error in ./node_modules/element-ui/lib/theme-chalk/index.css
解決辦法
找到webpack.dev.conf.js檔案,
其中有一行
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true})
},
把true改成false
4、如果重啟專案在執行之後還是報scope的那三個錯
把 <template slot-scope="scope">中的slot-scope改成