Giter VIP home page Giter VIP logo

laravel-vue-admin's Introduction

laravel,vue.js,element-ui 前后端分离的后台快速开发整合包

Description

本项目由laravel,PanJiaChen/vue-element-admin element-ui整合修改而成,权限控制精确到按钮,开箱即用,

Start

# 安装php依赖,配置.env
$ composer install 
$ php artisan migrate  
$ php artisan db:seed
# 前端依赖
$ cd backend    
$ npm install 
# 修改frontend/config/dev.env.js BASE_API 
$ npm run dev  // 运行

Permission

1.权限方面整合 spatie/laravel-permission,在此基础上修改了表结构,增加了 若干说明字段,根据路由判断权限
2.在登录的时候返回用户的所有权限放在store中,通过与下面的asyncRouterMap取交集过滤无权限菜单
3.在frontend/src/router/index.js中 meta.permissions包含这个页面所用到的权限(即后端路由)

export const asyncRouterMap = [
  {
    path: '/system',
    component: Layout,
    meta: { title: '系统管理', icon: 'system' },
    children: [
      {
        path: 'role',
        name: 'system-role',
        component: () => import('@/views/system/role'),
        meta: { title: '权限', icon: 'role',
          permissions: ['roles.index', 'roles.update', 'roles.destroy', 'roles.store'] }
      }
    ]
  },
  { path: '*', redirect: '/404', hidden: true }
]

4.在页面中,通过v-permission="roles.store" 判断按钮是否显示(如下)

<el-button v-permission="'roles.store'" @click="handleAddRole">新增角色</el-button>

5.整合一些常用的包

laravel-vue-admin's People

Contributors

zjwshisb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.