1、項目連接css
GitHub 地址: https://github.com/imxiaoer/ElementUIAdminvue
項目演示地址:https://imxiaoer.github.io/ElementUIAdmin/dist/indexios
2、項目依賴 git
3、項目截圖github
4、部分代碼vue-router
mock.jsvuex
import Mock from 'mockjs' const Random = Mock.Random // 用戶數據 const userData = () => { let users = [] for (let i = 0; i < 10; i++) { let user = { 'id': i + 1, 'date': Random.date('yyyy-MM-dd'), 'name': Random.cname(), 'address': Mock.mock('@county(true)'), 'phone': Mock.mock(/^1[0-9]{10}$/), 'status': Random.integer(0, 1) } users.push(user) } return users } Mock.mock('/api/users', userData) // 文章數據 const articleData = () => { let articles = [] for (let i = 0; i < 20; i++) { let article = { 'id': i + 1, 'date': Random.date('yyyy-MM-dd'), 'title': Random.csentence(), 'author': Random.cname(), 'content': Random.csentence(), 'status': Random.integer(0, 1) } articles.push(article) } return articles } Mock.mock('/api/articles', articleData)
main.jsvue-cli
import Vue from 'vue' import axios from 'axios' import App from './App.vue' import router from './router' import store from './store' import ElementUI from 'element-ui' import Utils from './common/utils' import 'element-ui/lib/theme-chalk/reset.css' import 'element-ui/lib/theme-chalk/index.css' import './mock.js' Vue.config.productionTip = false Vue.use(ElementUI) Vue.prototype.$http = axios Vue.prototype.Utils = Utils new Vue({ router, store, render: h => h(App) }).$mount('#app')
5、說明element-ui
1. 爲了能在Github上成功演示項目,修改了路徑配置,路徑配置在vue.config.js 中。本地 build 請刪除路徑配置axios
2. 此項目爲我的學習項目,若有疑問歡迎留言。發現BUG或代碼問題也麻煩提個醒,謝謝!若有幫助到你,給個star啦 :)
GitHub 地址: https://github.com/imxiaoer/ElementUIAdmin