日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

安裝element UI (全局引入與按需引入)

作者:第1006號小白 更新時間: 2022-02-11 編程語言

安裝element UI

全局引入

終端輸入

npm i element-ui -S

在這里插入圖片描述

import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';

Vue.use(ElementUI);

new Vue({
  el: '#app',
  render: h => h(App)
});

在這里插入圖片描述
這是我的
在這里插入圖片描述
在helloworld里面添加一個
<el-button>按鈕</el-button>可以明顯看到效果
在這里插入圖片描述

按需引入

在這里插入圖片描述
終端輸入

npm install babel-plugin-component -D

這里根據你的需要,比如我們這要用一個button控件,我引入的就是button
在這里插入圖片描述
官網提示
在這里插入圖片描述
這是我的

在這里插入圖片描述

"plugins": [
    [
      "component",
      {
        "libraryName": "element-ui",
        "styleLibraryName": "theme-chalk"
      }
    ]
  ]

運行之后與全局引入有一樣的效果,但是可以幫助我們減少項目的大小
如果此時加上radio這個控件
在這里插入圖片描述
對引入需要修改
在這里插入圖片描述

原文鏈接:https://blog.csdn.net/weixin_45626404/article/details/122824747

欄目分類
最近更新