当前位置:   article > 正文

vue-admin-template 动态路由的实现(方式二 推荐),如何快速的开发一个完整的直播app_vue-admin-template动态路由

vue-admin-template动态路由

export function logout() {

return request({

url: Api.TakeOut,

method: ‘get’

})

}

登录接口数据

{‘code’: 200, ‘data’: {‘token’: ‘X-admin’}, ‘message’: “操作成功”}

退出接口数据

{‘code’: 200, ‘data’: ‘success’, ‘message’: “操作成功”}

详情接口数据

{

“code”: 200,

“data”: {

“avatar”: “https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif”,

“name”: “黄晓果”,

“roles”: [

“editor”

]

}

}

  • 改造router/index.js

import Vue from ‘vue’

import Router from ‘vue-router’

Vue.use(Router)

/* Layout */

import Layout from ‘@/layout’

// 基础路由

export const constantRoutes = [

{

path: ‘/login’,

component: () => import(’@/views/login/index’),

hidden: true

},

{

path: ‘/404’,

component: () => import(’@/views/404’),

hidden: true

},

{

path: ‘/’,

component: Layout,

redirect: ‘/dashboard’,

children: [{

path: ‘dashboard’,

name: ‘Dashboard’,

component: () => import(’@/views/dashboard/index’),

meta: { title: ‘首页’, icon: ‘el-icon-menu’ }

}]

},

]

/**

  • 动态路由

*/

export const asyncRoutes = [

{

path: ‘/studentinformation’,

component: Layout,

children: [

{

path: ‘index’,

component: () => import(’@/views/studentinformation/index’),

meta: { title: ‘学生信息’, icon: ‘el-icon-s-check’ }

}

]

},

{

path: ‘/lecturerinformation’,

component: Layout,

children: [

{

path:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/58956
推荐阅读
相关标签
  

闽ICP备14008679号