vue 安裝並匯入 Element UI

2020-10-06 12:00:51

第一步安裝Element UI

首先進入vue專案所在的cmd目錄輸入:
npm i element-ui -S

設定main.js檔案

在組態檔中加入這三句話,引入Element UI
import ElementUI from ‘element-ui’;
import ‘element-ui/lib/theme-chalk/index.css’;
Vue.use(ElementUI);

import Vue from 'vue'
import App from './App'
import VueRouter from './router'
import qs from 'querystring'
import axios from 'axios'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

Vue.prototype.qs=qs
Vue.prototype.$axios=axios
Vue.config.productionTip = false
const router=new VueRouter()

new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})