当前位置: 首页 > news >正文

安徽 电子政务网站定制病历图片在线制作

安徽 电子政务网站定制,病历图片在线制作,郑州网站推广优化外包公司,怎么进入微信公众号平台十三、文章分类页面 - [element-plus 表格] Git仓库:https://gitee.com/msyycn/vue3-hei-ma.git 基本架子 - PageContainer 功能需求说明: 基本架子-PageContainer封装文章分类渲染 & loading处理文章分类添加编辑[element-plus弹层]文章分类删除…

十三、文章分类页面 - [element-plus 表格]

Git仓库:https://gitee.com/msyycn/vue3-hei-ma.git

基本架子 - PageContainer

功能需求说明:

  1. 基本架子-PageContainer封装
  2. 文章分类渲染 & loading处理
  3. 文章分类添加编辑[element-plus弹层]
  4. 文章分类删除
  1. 基本结构样式,用到了el-card 组件
<template><el-card class="page-container"><template #header><div class="header"><span>文章分类</span><div class="extra"><el-button type="primary">添加分类</el-button></div></div></template>...</el-card>
</template><style lang="scss" scoped>
.page-container {min-height: 100%;box-sizing: border-box;.header {display: flex;align-items: center;justify-content: space-between;}
}
</style>
  1. 考虑到多个页面复用,封装成组件
    • props 定制标题(父传子)
    • 默认插槽 default 定制内容主体
    • 具名插槽 extra 定制头部右侧额外的按钮
<script setup>
defineProps({title: {required: true,type: String}
})
</script><template><el-card class="page-container"><template #header><div class="header"><span>{{ title }}</span><div class="extra"><slot name="extra"></slot></div></div></template><slot></slot></el-card>
</template><style lang="scss" scoped>
.page-container {min-height: 100%;box-sizing: border-box;.header {display: flex;align-items: center;justify-content: space-between;}
}
</style>
  1. 页面中直接使用测试 ( unplugin-vue-components 会自动注册)
  • 文章分类测试:
<template><page-container title="文章分类"><template #extra><el-button type="primary"> 添加分类 </el-button></template>主体部分</page-container>
</template>
  • 文章管理测试:
<template><page-container title="文章管理"><template #extra><el-button type="primary">发布文章</el-button></template>主体部分</page-container>
</template>

视图预览请添加图片描述

文章分类渲染

封装API - 请求获取表格数据

  1. 新建 api/article.js 封装获取频道列表的接口
import request from '@/utils/request'
export const artGetChannelsService = () => request.get('/my/cate/list')
  1. 页面中调用接口,获取数据存储
const channelList = ref([])const getChannelList = async () => {const res = await artGetChannelsService()channelList.value = res.data.data
}
  1. ArticleChannel.vue
<script setup>
import { artGetChannelsService } from '@/api/article'
import {ref} from 'vue'const channelList = ref([]) // 文章分类列表
// 获取文章分类列表
const getChannelList = async () => {const res = await artGetChannelsService()channelList.value = res.data.dataconsole.log('文章分类列表',channelList.value);}// 调用获取文章分类列表
getChannelList()
</script><template><div><!-- 按需引入 --><page-container title="文章分类"> <!-- 右侧按钮 - 添加文章 - 具名插槽 --><template #extra><el-button>添加分类</el-button></template>主体部分--表格</page-container></div>
</template><style lang="scss" scoped>
</style>

视图预览

请添加图片描述

el-table 表格动态渲染

<el-table :data="channelList" style="width: 100%"><el-table-column label="序号" width="100" type="index"> </el-table-column><el-table-column label="分类名称" prop="cate_name"></el-table-column><el-table-column label="分类别名" prop="cate_alias"></el-table-column><el-table-column label="操作" width="100"><template #default="{ row }"><el-button:icon="Edit"circleplaintype="primary"@click="onEditChannel(row)"></el-button><el-button:icon="Delete"circleplaintype="danger"@click="onDelChannel(row)"></el-button></template></el-table-column><template #empty><el-empty description="没有数据" /></template>
</el-table>const onEditChannel = (row) => {console.log(row)
}
const onDelChannel = (row) => {console.log(row)
}

预览视图

请添加图片描述

el-table 表格 loading 效果

  1. 定义变量,v-loading绑定
const loading = ref(false)<el-table v-loading="loading">
  1. 发送请求前开启,请求结束关闭
const getChannelList = async () => {loading.value = trueconst res = await artGetChannelsService()channelList.value = res.data.dataloading.value = false
}

ArticleChannel.vue

<script setup>
import { artGetChannelsService } from '@/api/article'
import { Delete,Edit } from   '@element-plus/icons-vue'import {ref} from 'vue'const channelList = ref([]) // 文章分类列表
const loading = ref(false) //加载状态
// 获取文章分类列表
const getChannelList = async () => {// 发请求之前先将loading设置为trueloading.value = true// 调用接口const res = await artGetChannelsService()channelList.value = res.data.data// 发完请求,关闭loadingloading.value = false// console.log('文章分类列表',channelList.value);}// 调用获取文章分类列表
getChannelList()// 编辑文章分类
const onEditChannel =(row,$index) =>{
console.log(row,$index)}// 删除文章分类
const onDelChannel =(row,$index)=>{console.log(row,$index)}
</script><template><div><!-- 按需引入 --><page-container title="文章分类"> <!-- 右侧按钮 - 添加文章 - 具名插槽 --><template #extra><el-button>添加分类</el-button></template><!-- 主体部分--表格 --><el-table :data="channelList" style="width: 100%" v-loading="loading"><el-table-column   label="序号"    type="index"  width="100" ></el-table-column><el-table-column   label="分类名称" prop="cate_name" ></el-table-column><el-table-column   label="分类别名" prop="cate_alias" ></el-table-column><el-table-column   label="操作"      width="100"><template #default="{row,$index}"><el-button  @click="onEditChannel(row,$index)" plain :icon="Edit" circle type="primary" ></el-button><el-button  @click="onDelChannel(row,$index)" plain :icon="Delete" circle type="danger" ></el-button></template></el-table-column></el-table></page-container></div>
</template><style lang="scss" scoped>
</style>

请添加图片描述

请求到的数组为空时

 channelList.value = []

请添加图片描述

添加element-plus插槽:

     <!-- 主体部分--表格 --><el-table :data="channelList" style="width: 100%" v-loading="loading"><el-table-column   label="序号"    type="index"  width="100" ></el-table-column><el-table-column   label="分类名称" prop="cate_name" ></el-table-column><el-table-column   label="分类别名" prop="cate_alias" ></el-table-column><el-table-column   label="操作"      width="100"><template #default="{row,$index}"><el-button  @click="onEditChannel(row,$index)" plain :icon="Edit" circle type="primary" ></el-button><el-button  @click="onDelChannel(row,$index)" plain :icon="Delete" circle type="danger" ></el-button></template></el-table-column><!-- 没有数据 --><template #empty><el-empty description="暂无数据"></el-empty></template></el-table>

请添加图片描述
下期见!

http://www.yayakq.cn/news/26492/

相关文章:

  • 母婴网站模板邵阳邵东网站建设
  • 长沙鞋网站建设电子商务安全问题 网站权限管理
  • 相亲网站怎么做的网站建设公司 深圳信科
  • 企业网站如何建设报告怎么搭建支付网站
  • 上饶做网站哪家好哦利用赞赏码做网站收款
  • 免费网站建设新技术网页设计实验报告实验1
  • 青州哪里做网站做得好怎样登录建设互联网站
  • 成都网站建设制作公司画册设计免费模板
  • 公司高端网站建永嘉移动网站建设公司
  • 免费网站app哪个好竹业网站建设
  • 网站基站的建设方案网站开发 需要用到什么软件
  • 网站分享正能量单栏wordpress主题
  • 网站加黑链服饰技术支持 东莞网站建设
  • 请简述网站开发的流程图建筑图纸怎样识图
  • 国内wordpress模板台州网站优化方案
  • 如何做别人的网站厦门工程网站建设
  • wordpress建站购买口碑营销成功的案例
  • 运动网站设计公司简单网站多少钱
  • 高性能网站建设 下载网站不备案不能用吗
  • 想做一个自己设计公司的网站怎么做的上海做公司网站
  • 云一网站设计旧房翻新装修
  • 国外用python做的网站深圳企业有限公司
  • php网站开发技术环境要求网站怎么做rss
  • 网站建站基础漯河 网站建设
  • 用手机怎么看自己做的网站那里有个人做网站的
  • 南京网站优化快速排名除了亚马逊还有啥网站做海淘
  • 在域名做网站品牌建设与营销的关系
  • 北京网站设计公司sx成都柚米科技15自动生成网页代码的软件
  • 山东做网站建设公司排名广西住房和城乡建设厅三类人员继续教育
  • 网站模块顺序调整html编辑器怎么用