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

佛山小学网站建设做贷款的网站

佛山小学网站建设,做贷款的网站,建设网站哪些好,沈阳化工大学建设工程网上文是对el-table的基本封装&#xff0c;只能满足最简单的应用&#xff0c;本文主要是在上文的基础上增加slot插槽&#xff0c;并且对col插槽进行拓展&#xff0c;增加通用性 // BaseTable.vue <template><el-table><template v-for"name in tableSlots&…

上文是对el-table的基本封装,只能满足最简单的应用,本文主要是在上文的基础上增加slot插槽,并且对col插槽进行拓展,增加通用性

// BaseTable.vue

<template><el-table><template v-for="name in tableSlots" :key="name" #[name]><slot :name="name"></slot></template><el-table-column v-for="(col,index) in $attrs.config" :key="index" v-bind="col"><template v-if="col.slot" #[getColSlot(col)]="scope" ><slot :name="col.slot" v-bind="scope"></slot></template></el-table-column></el-table>
</template>
<script lang="ts" setup>
const slots=useSlots();
const tableSlots=computed(()=>{// 原生el-table插槽只有default,append,empty// 原生el-table-column插槽只有table插槽只有default,header// 这里将header单独处理,认为是col的插槽,从table插槽中排除return Object.keys(slots).filter(name=>name!=='header')
})
const getColSlot=(col)=>{return col.slot==='header'?'header':'default'
}
</script>

//index.vue

<template><BaseTable :config="config" :data="tableData" :style="{width:'800px'}"><template #status="scope"><el-text :type="scope.row.status.type ">{{ scope.row.status.content }}</el-text></template><template #btn="scope"><el-button type="primary">{{ scope.row.btn }}</el-button></template><!-- 如有多个类似slot,也可以用如下方式渲染 --><!-- <template  v-for="(col,index) in config.filter(item=>item.slot && item.slot!=='header')" :key="index" #[col.slot]="scope"><el-button type="primary">{{ scope.row.btn }}</el-button></template> --><template #header="scope"><el-button type="primary">{{ scope.column.label }}</el-button></template></BaseTable>
</template><script lang="ts" setup>
import BaseTable from './BaseTable.vue'
const config=[{type:'selection'},{prop: 'date',label:'日期',width:'180'},{prop: 'name',label:'姓名',},{prop: 'status',label:'状态',slot:'status',width:'180'},{prop: 'btn',label:'操作',slot:'btn',width:'180'},{prop: 'header',label:'按钮header',slot:'header',width:'180'},
];
const tableData = [{date: '2016-05-03',name: '张三',status:{content:'工作',type:'success'},btn: 'confirm',},{date: '2016-05-02',name: '李四',status:{content:'出差',type:'primary'},btn: 'confirm',},{date: '2016-05-04',name: '王五',status:{content:'休假',type:'danger'},btn: 'confirm',},
]
</script>
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/dad5e7be52c84c12997da0829cdf9178.png)
http://www.yayakq.cn/news/57154/

相关文章:

  • 徐州专门做网站百度seo如何快速排名
  • 社交网站图片展示软件开发管理工具
  • ICP备案不停网站做侵权网站用哪里的服务器稳
  • 阿里巴巴网站建设初衷会员卡系统一般哪里买
  • 自己做的图片哪个网站可以出售做微信小程序需要什么技术
  • 把网站放在虚拟主机上 怎么进入网站后台网站建设宝安
  • 常见的营销型网站手机网站的优势
  • 示范校建设专题网站昆山网站建设培训学校
  • 建设工程申报系统网站wordpress文章怎么加关键词描述
  • 有哪些中文域名网站做公司简介网站
  • 国外域名购买网站江西网站建设公司费用
  • 免费建设门户网站微信第三方开发平台
  • 合肥网页网站制作做网站 中企动力
  • 上海网站推广服务wordpress搭建博客视频教程
  • 哈尔滨模板网站建站百度在西安有分公司吗
  • 网站建设教学工作总结6重庆知名网站
  • 在godaddy做网站贵吗网站制作需要什么软件有哪些
  • 企业网站icp备案申请做钓鱼网站会被抓吗
  • 一个网站绑定多个域名公众号微网站建设
  • 自适应平台网站模板网页编程是什么
  • 网站变exe文件怎么做私人影吧服务器
  • 网络口碑营销案例分析seo职位全称
  • 韶关哪里做网站最好白鹭引擎做网站
  • 网站建设带数据库模板wordpress微信h5支付
  • 建设网站 翻译wordpress 导入的模板
  • 站点建设方案百度账号免费注册
  • 公司网站维护内容网站建设死人接单
  • 做网站用dw还是vs织梦网站更改标题长度
  • wordpress多个single泉州seo关键词排名
  • 做网站广告软件wordpress最新版爆破