栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Vue.js

VUE基于ElementUI搭建的简易单页后台

Vue.js 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

VUE基于ElementUI搭建的简易单页后台

一、项目链接

GitHub 地址: https://github.com/imxiaoer/ElementUIAdmin

项目演示地址:https://imxiaoer.github.io/ElementUIAdmin/dist/index

 

二、项目依赖 

  1. 数据请求         "axios": "^0.18.0",

  2. 图表控件         "echarts": "^4.2.0-rc.2",

  3. 富文本编辑器     "vue-quill-editor": "^3.0.6",

  4. 路由         "vue-router": "^3.0.1",

  5.状态管理        "vuex": "^3.0.1"

  6.数据模拟        "mockjs": "^1.0.1-beta3",

 

三、项目截图

 

 

 

四、部分代码

mock.js

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.js

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 = falseVue.use(ElementUI)
Vue.prototype.$http = axios
Vue.prototype.Utils = Utilsnew Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

 

五、说明

1. 为了能在Github上成功演示项目,修改了dist目录中 index.html 里面的 css 和 js 文件的引用路径。

原路径: 

修改后路径: 

 

2. 此项目为个人学习项目,如有疑问欢迎留言。发现BUG或代码问题也麻烦提个醒,谢谢!如有帮助到你,给个star啦 :)

 

GitHub 地址: https://github.com/imxiaoer/ElementUIAdmin

项目演示地址:https://imxiaoer.github.io/ElementUIAdmin/dist/index

原文出处:https://www.cnblogs.com/similar/p/10240341.html  

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/240359.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号