vue+element-uijyadmin后台管理系统模板-集成方案项目搭建篇1(代码片段)

wxy-zhangxiaobin wxy-zhangxiaobin     2022-12-02     789

关键词:

 

 

项目搭建时间:2020-06-29

本章节:讲述基于vue/cli,

项目的基础搭建。

本主题讲述了vue+element-ui JYAdmin  后台管理系统模板-集成方案,从零到一的手写搭建全过程。

该项目不仅是一个持续完善、高效简洁的后台管理系统模板,还是一套企业级后台系统开发集成方案,致力于打造一个
与时俱进、高效易懂、高复用、易维护扩展的应用方案。

 

(1)、 检查环境


 

 技术图片

 

 

 

1、vue create vueapp 默认安装


 技术图片

 

 

 

2、启动项目



$ cd vueapp
$ npm run serve

 技术图片

 

 

 

 

  3、IE兼容测试 支持IE11

4、安装路由和vuex

cnpm install --save vue-router
cnpm install --save vuex

  

5、安装sass和element-ui

cnpm install --save sass-loader
cnpm install --save node-sasscnpm i element-ui -S

  

5.1、按需引入element-ui

cnpm install babel-plugin-component -D

  

然后,将 .babelrc 修改为:

  "presets": [["es2015",  "modules": false ]],
  "plugins": [
    [
      "component",
      
        "libraryName": "element-ui",
        "styleLibraryName": "theme-chalk"
      
    ]
  ]

  

接下来,如果你只希望引入部分组件,比如 Button 和 Select,那么需要在 main.js 中写入以下内容:

 

import Vue from ‘vue‘;
import  Button, Select  from ‘element-ui‘;
import App from ‘./App.vue‘;

Vue.component(Button.name, Button);
Vue.component(Select.name, Select);
/* 或写为
 * Vue.use(Button)
 * Vue.use(Select)
 */

new Vue(
  el: ‘#app‘,
  render: h => h(App)
);

  

目录结构如下

技术图片

 

 

 

 

5、路由配置 (@/router/index.js)

 

import Vue from ‘vue‘

import Router from ‘vue-router‘

import routes from ‘./router‘

 

Vue.use(Router)

 

const router = new Router(

  routes,

  // mode: ‘history‘,

  // base: ‘/html/chat‘

)

 

// 登陆页面路由 name

// const LOGIN_PAGE_NAME = ‘login‘

 

// 跳转之前

router.beforeEach((to, from, next) => 

  if (to.name) 

    next()

  

  // const token = getToken()

  // if (!token && to.name !== LOGIN_PAGE_NAME) 

  //   // 未登录且要跳转的页面不是登录页

  //   next(

  //     name: LOGIN_PAGE_NAME // 跳转到登录页

  //   )

  //  else if (!token && to.name === LOGIN_PAGE_NAME) 

  //   // 未登陆且要跳转的页面是登录页

  //   next() // 跳转

  //  else if (token && to.name === LOGIN_PAGE_NAME) 

  //   // 已登录且要跳转的页面是登录页

  //   next(

  //     name: ‘index‘ // 跳转到 index 页

  //   )

  //  else 

  //   if (token) 

  //     next() // 跳转

  //    else 

  //     next(

  //       name: LOGIN_PAGE_NAME

  //     )

  //   

  // 

)




// 跳转之后

// router.afterEach(to => 

//   //

// )

 

export default router

  

5.1、路由配置 (@/router/router.js)

 

/**

 * meta 可配置参数

 * @param boolean icon 页面icon

 * @param boolean keepAlive 是否缓存页面

 * @param string title 页面标题

 */

export default [

  

    path: ‘/‘,

    redirect: ‘/jsDemo‘

  ,

  

    path: ‘/jsDemo‘,

    name: ‘jsDemo‘,

    component: () => import(‘@/pages/jsDemo/index.vue‘),

    meta: 

      icon: ‘‘,

      keepAlive: true,

      title: ‘jsDemo‘

    

  ,

  

    path: ‘/tsDemo‘,

    name: ‘tsDemo‘,

    component: () => import(‘@/pages/tsDemo/index.vue‘),

    meta: 

      icon: ‘‘,

      keepAlive: false,

      title: ‘tsDemo‘

    

  

]

  

6、store配置 (@/store/index.js)
import Vue from ‘vue‘

 

import Vuex from ‘vuex‘





// modules

 

import getters from ‘./getters‘

 

import user from ‘./modules/user‘

 

Vue.use(Vuex)





export default new Vuex.Store(

 

  state: 

 

    count: 1

 

  ,

 

  mutations: 

 

    increment(state, n) 

 

      // 变更状态

 

      state.count = n

 

    

 

  ,

 

  actions: 

 

    increment( commit , count) 

 

      commit(‘increment‘, count)

 

    ,

 

    incrementA( commit , count) 

 

      return new Promise((resolve) => 

 

        commit(‘increment‘, count)

 

        resolve()

 

      )

 

    ,

 

  ,

 

  modules: 

 

    user

 

  ,

 

  getters

 

)


  

6.1、store配置 (@/store/getters.js)
const getters = 

 

    user: state => state.user,

 



 

export default getters

  

6.2、store配置 (@/store/modules/user.js)

 

const user = 

 

    state: 

 

        name: ‘zxb‘

 

    ,





    mutations: 

 

        SET_NAME: (state, name) => 

 

            state.name = name

 

        

 

    ,





    actions: 

 

        setName( commit , name) 

 

            commit(‘SET_NAME‘, name)

 

        

 

    ,

 

    getters: 

 

        users(state) 

 

            return state

 

        

 

    

 







export default user

  

7、主路由组件调用 store (@/pages/jsDemo/index.vue)
<template>

  <div>jsDemo1</div>

</template>

 <script lang="js" src="./jsDemo.js"></script>

 <style lang="scss" src="./jsDemo.scss"  scoped>

  

7.1、主路由组件调用 store (@/pages/jsDemo/jsDemo.js)

 

export default 

    name: ‘jsDemo‘,

    components: 

 

    ,

    data() 

        return 

 

        

    ,

    props: 

 

    ,

    computed: 

    ,

    filters: 

    ,

    activated() 

 

    ,

    created() 




    ,

    mounted() 

        this.$store.state.count = 1

        console.log(this.$store.state.count)

        this.$store.commit(‘increment‘, 10)

        console.log(this.$store.state.count)

        this.$store.dispatch(‘increment‘, 50)

        console.log(this.$store.state.count)

        this.$store.dispatch(‘incrementA‘, 60).then(() => 

            console.log(this.$store.state.count)

        )

        console.log(this.$store.state.count)

        this.$store.commit(‘SET_NAME‘, ‘zxb1‘)

        console.log(this.$store.state.user.name)

 

    ,

    updated() 

 

    ,

    destroyed() 

 

    ,

    methods: 

 

    


  

最终效果如下:

 技术图片

 

 

 

本章节总结:讲述基于vue/cli,

项目的基础搭建。

1、vue/cl基础配置,sass、element-ui安装

2、基础路由配置

3、ie浏览器兼容测试

4、vuex安装与使用

 

如需下载源代码请联系博主

(微信号:lovehua_5360)

你也可以选择留言反馈

 

     


下章节请关注个人微信公众号【微信悦】,欢迎持续关注:

备注:(使用微信客户端打开)

个人微信公众号:【微信悦】

微信公众号原文链接:http://mp.weixin.qq.com/mp/homepage?__biz=MzIyOTg4MzQyNw==&hid=15&sn=4bc799ac6079fd28d20365f92eb3cb91&scene=18#wechat_redirect

      

 

 

 

 

   

 

vue后台管理系统

...动APP、移动Web、微信小程序等多种终端访问方式。2.电商后台管理系统的功能电商后台管理系统用于管理用户账号、商品分类、商品信息、订单、数据统计等业务功能。3.电商后台管理系统的开发模式(前后端分离)电商后台管... 查看详情

vue2后台管理系统解决方案

Vue2后台管理系统解决方案linshuai1天前基于Vue.js2.x系列+ElementUI的后台管理系统解决方案。github地址:lin-xin/manage-systemdemo地址:manage-system前言之前在公司用了Vue+Element组件库做了个后台管理系统,基本很多组件可以直接引用组件库... 查看详情

vue项目实战:电商后台管理系统(vue+vuerouter+axios+element)(代码片段)

目录电商后台管理系统1.功能开发模式技术选型登录用户管理权限管理角色列表权限列表商品管理商品列表分类参数商品分类订单管理数据统计2.技术问题登录功能保存token路由导航守卫控制访问权限退出功能通过axios请求拦截器... 查看详情

一步步带你做vue后台管理框架——登录功能

系列教程《一步步带你做vue后台管理框架》第三课 github地址:vue-framework-wz线上体验地址:立即体验 《一步步带你做vue后台管理框架》第一课:介绍框架《一步步带你做vue后台管理框架》第二课:上手使用   认证... 查看详情

springboot和vue集成视频播放组件——基于springboot和vue的后台管理系统项目系列博客(二十二)(代码片段)

系列文章目录系统功能演示——基于SpringBoot和Vue的后台管理系统项目系列博客(一)Vue2安装并集成ElementUI——基于SpringBoot和Vue的后台管理系统项目系列博客(二)Vue2前端主体框架搭建——基于SpringBoot和Vue的后... 查看详情

vue开发后台管理系统小结

最近工作需要用vue开发了后台管理系统,由于是第一次开发后台管理系统,中间也遇到了一些坑,想在这里做个总结,也算是对于自己工作的一个肯定。我们金融性质的网站所以就不将代码贴出来哈一、项目概述首先工作需求是... 查看详情

vue2.0+elementui后台管理系统

vue2.0和elementui 搭建的一个后台管理系统概述:  这是一个用vuejs2.0和element搭建的后台管理界面。 技术栈:  vue2.0:渐进式JavaScript框架,易用、灵活、高效,似乎任何规模的应用都适用。  element ui:基于vue2.0... 查看详情

vue+element搭建后台管理系统(代码片段)

接口请求格式定义前台显示需要后台数据,我们这里先把前后端交互接口定义好,没有后台的时候,也方便用mock模拟。接口定义遵循几个规范:1.接口按功能模块划分。系统登录:登录相关接口用户管理:用户管理相关接口机构... 查看详情

vue后台管理框架(代码片段)

├──build//构建相关├──config//配置相关├──src//源代码│├──api//所有请求│├──components//全局UI组件│├──directives//全局指令│├──mock//mock数据│├──router//路由│├──store//全局store管理│├──utils//全局... 查看详情

基于vue实现的新闻后台管理系统-一

基于VUE实现的新闻后台管理系统前段时间拿到一个关于新闻后台的API,测试数据库使用SQLite,Restful服务是用Go写的,只要运行特定环境下的脚本(run.*)就会启动一个服务,依次后台为接口,进行新闻后台的开发。?目录结构|--Small-C... 查看详情

vueadmin-基于vue&bulma后台管理面板

  VueAdmin是一个基于Vue2.0&Bulma0.3 的后台管理面板(管理系统),相当于是Vue版本的Bootstrap 管理系统,提供了一组通用的后台界面UI和组件,其中还有丰富的图表组件,开箱即用。赶紧来体验一下吧。   在... 查看详情

后台管理系统模板

1:vue-element-adminGithub地址:https://github.com/PanJiaChen/vue-element-admindemo预览体验地址:https://panjiachen.github.io/vue-element-admin/#/dashboard一个基于vue2.0和Eelement的控制面板UI框架,这是使用vue技术栈开发的前端程序员的首选管理系统模板 查看详情

vue后台管理界面

参考技术A一、vue里页面之间传参通过router-link二、vue里获取接口数据和js原生对比不然发现有不同的地方,这里是对接口进行了一些封装三、结合数组函数map实现二级联动四、结合数组函数push、indexOf、splice增删输入框五、渲染列... 查看详情

使用vue3.0和element实现后台管理模板

使用vue3.0和element实现后台管理模板:https://www.cnblogs.com/zhoulifeng/p/10123632.html 通过自己所学的这段时间,利用空余时间,使用vue3.0脚手架搭建的一个关于后台的管理模板,所实现功能也是模仿一个后台的界面,数据分为两种存... 查看详情

vue3+.net6,轻松开发管理后台!(可复用)

在GitHub是没找到简单好用的Vue3+.NET6管理后台项目,有收藏的请评论区分享。这里分享一套Vue3+Axios+TS+Vite+ElementPlus+.NET6WebAPI+JWT+SqlSugar的通用管理后台,前后端分离架构,各种最新框架组件,... 查看详情

java之springboot+springsecurity+vue实现后台管理系统的开发三系统权限(代码片段)

Java之SpringBoot+SpringSecurity+Vue实现后台管理系统的开发【一、前端】跳转Java之SpringBoot+SpringSecurity+Vue实现后台管理系统的开发【二、后端】跳转Java之SpringBoot+SpringSecurity+Vue实现后台管理系统的开发【三、系统权限... 查看详情

前端vue+elementui案例:通用后台管理系统-项目总结(代码片段)

...相关链接参考视频:VUE项目,VUE项目实战,vue后台管理系统,前端面试,前端面试项目案例链接【前端】Vue+ElementUI案例:通用后台管理系统-导航栏(视频p1-16)https://blog.csdn.net/karshey/article/details... 查看详情

一步步带你做vue后台管理框架——上手使用

系列教程《一步步带你做vue后台管理框架》第二课github地址:vue-framework-wz线上体验地址:立即体验  闲扯再多不会用也没白搭,这节课我来带大家直接上手框架,体验到简单方便之后你就会爱上这个框架欲罢不能的。  首... 查看详情