6、分类列表页设计

这是页面设计出来的效果图:

这设计过程没什么需要讲的,就是去element官网找自己需要的样式进行复制粘贴即可

直接上代码,大家复制粘贴即可

CategoryView.vue 修改代码:

<template>
  <el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>商品分类</span>
        <el-button type="primary" icon="CirclePlus" round>添加分类</el-button>
      </div>
    </template>
    <el-table :data="tableData" stripe style="width: 100%">
      <el-table-column prop="id" label="Id" width="180" />
      <el-table-column prop="name" label="名称" width="180" />
      <el-table-column fixed="right" label="操作" width="180">
        <template #default>
          <el-button type="success" size="small">修改</el-button>
          <el-button type="danger" size="small">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>


<script setup>
const tableData = [
  {
    date: "2016-05-03",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles"
  },
  {
    date: "2016-05-02",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles"
  },
  {
    date: "2016-05-04",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles"
  },
  {
    date: "2016-05-01",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles"
  }
];
</script>

App.vue修改代码

<template>
  <el-container class="layout-container-demo">
    <el-aside width="200px">
      <el-scrollbar>
        <div class="mb-2 logo">Vue3+core6 WebAPI</div>
        <el-menu
          :default-openeds="['1', '2']"
          active-text-color="#ffd04b"
          background-color="#303133"
          text-color="#fff"
          :router="true"
        >
          <el-sub-menu index="1">
            <template #title>
              <el-icon>
                <message />
              </el-icon>店铺管理
            </template>
            <el-menu-item-group>
              <el-menu-item index="/">
                <el-icon>
                  <HomeFilled />
                </el-icon>首页
              </el-menu-item>
              <el-menu-item index="/category">
                <el-icon>
                  <Operation />
                </el-icon>分类管理
              </el-menu-item>
              <el-menu-item index="1-3">
                <el-icon>
                  <ShoppingBag />
                </el-icon>商品管理
              </el-menu-item>
            </el-menu-item-group>
          </el-sub-menu>
          <el-sub-menu index="2">
            <template #title>
              <el-icon>
                <Setting />
              </el-icon>系统设置
            </template>
            <el-menu-item-group>
              <el-menu-item index="2-1">
                <el-icon>
                  <Edit />
                </el-icon>修改密码
              </el-menu-item>
            </el-menu-item-group>
          </el-sub-menu>
        </el-menu>
      </el-scrollbar>
    </el-aside>

    <el-container>
      <el-header style="text-align: right; font-size: 12px">
        <div class="toolbar">
          <el-dropdown>
            <el-icon style="margin-right: 8px; margin-top: 1px">
              <setting />
            </el-icon>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item>View</el-dropdown-item>
                <el-dropdown-item>Add</el-dropdown-item>
                <el-dropdown-item>Delete</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
          <span>Tom</span>
        </div>
      </el-header>

      <el-main>
        <router-view></router-view>
      </el-main>

      <el-footer>Footer</el-footer>
    </el-container>
  </el-container>
</template>

<script  setup>
</script>

<style scoped>
.logo {
  height: 50px;
  color: white;
  text-align: center;
  line-height: 50px;
  font-weight: bold;
}
/* 设置整体高度 */
.layout-container-demo {
  height: 100vh;
}
.layout-container-demo .el-header {
  position: relative;
  /* background-color: var(--el-color-primary-light-7); */
  background-color: white;
  color: var(--el-text-color-primary);
  box-shadow: var(--el-box-shadow-light);
}
.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  /* background: var(--el-color-primary-light-8); */
  background-color: #303133;
}
.layout-container-demo .el-menu {
  border-right: none;
}
.layout-container-demo .el-main {
  padding: 0;
  box-shadow: var(--el-box-shadow-light);
  margin: 10px 0;
}
.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}

.el-footer {
  box-shadow: var(--el-box-shadow-light);
}
</style>

<!-- 全局样式 -->
<style>
.card-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.box-card {
  width: 100wh;
  height: 100vh;
}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值