cdn引入element-ui


    • 在index.html中:
    <script src="../static/js/vue.js"></script>
    <link href="https://cdn.bootcss.com/element-ui/2.4.5/theme-chalk/index.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/element-ui/2.4.5/index.js"></script>
    • 在vue.config.js中配置:
module.exports = {
assetsDir: 'static',
// 指定`build`時,在靜態文件上一層添加static目錄
configureWebpack: {
externals: {
'vue': 'Vue',
'element-ui': 'ELEMENT' // 注意大寫
}
}
};
    • 在main.js中:
import ELEMENT from 'element-ui';

Vue.config.productionTip = false
Vue.use(ELEMENT)  //注意大寫
    • 相關事項
使用cli的版本是4.3.1,需要注意:vue.config.js文件中ELEMENT必須大寫,main.js也是大寫的
    • 項目目錄:node_modules文件略


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM