跳到主要内容

7、后台系统-分类管理

分类管理就是对商品的分类数据进行维护。常见的分类数据:电脑办公、玩具乐器、家居家装、汽车用品...

1.1 菜单添加

首先在系统中添加分类管理的菜单,具体步骤如下所示:

1、在后台管理系统中通过系统管理的菜单管理添加分类管理的相关菜单,如下所示:

image-20230718144251873

2、给系统管理员角色分配分类管理菜单访问权限:

image-20230522220958414

3、在前端项目中创建对应的页面,以及配置对应的异步路由

  • 在src/views下创建文件夹product
  • 在product文件夹下创建文件 category.vue

image-20230718144535709

  • 在src/router/modules文件夹下创建product.js路由文件,文件内容如下所示:
const Layout = () => import('@/layout/index.vue')
const category = () => import('@/views/product/category.vue')

export default [
{
path: '/product',
component: Layout,
name: 'product',
meta: {
title: '商品管理',
},
icon: 'Histogram',
children: [
{
path: '/category',
name: 'category',
component: category,
meta: {
title: '分类管理',
},
},
],
},
]