下面操作在main.js文件中進行
完整引入:
import Element from 'element-ui';
//樣式文件,需單獨引入
import 'element-ui/lib/theme-chalk/index.css';
//在引入前需要npm安裝element-ui
Vue.use(Element, { size: 'small' });
屬性size
取值 ( small ,big ,
) ,決定組件尺寸的大小。
按需引入:
import { Pagination, Dialog, ···省略··· Footer, Loading, MessageBox, Message, Notification } from 'element-ui'; //樣式文件,需單獨引入 import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Pagination);
Vue.use(Dialog);
···省略···
Vue.use(Footer);
Vue.use(Loading.directive);
Vue.prototype.$loading = Loading.service;
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;
Vue.prototype.$message = Message;
轉自:https://blog.csdn.net/qq_35393869/article/details/80351487