- 在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)