20-Vue实战项目:电商管理系统(Element-UI)-角色列表

角色列表-通过路由展示角色列表组件

1.在 power 文件夹下,新建 Roles.vue
2.在 index.js 中进行导入

// 全局导入
import Roles from '../components/power/Roles.vue'

{
   
      path: '/home',
      component: Home,
      redirect: '/welcome',
      children: [
        {
    path: '/welcome', component: Welcome },
        {
    path: '/users', component: Users },
        {
    path: '/rights', component: Rights },
        // 作为 home 页面的子路由
        {
    path: '/roles', component: Roles }
      ]
    }

角色列表-绘制基本布局结构并获取列表数据

1.卡片视图布局

<!-- 卡片视图 -->
    <el-card>
      <!-- 添加角色按钮区域 -->
      <el-row>
        <el-col>
            <el-button type="primary">添加角色</el-button>
        </el-col>
      </el-row>
    </el-card>

2.通过调用API获取数据

  data () {
   
    return {
   
      // 所有角色列表数据
      roleList: []
    }
  },
  // 生命周期函数
  created () {
   
    this.getRolesList()
  },
  methods: {
   
    // 获取所有角色的列表
    async getRolesList (
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值