当前位置: 首页 > 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.tj-hxxt.cn/news/95735.html

相关文章:

  • 网站优化怎么做哪家培训机构好
  • 西安门户网站建设百度下载安装官方下载
  • 学做美食视频网站电商seo与sem是什么
  • photoshop+做网站logo发表文章的平台有哪些
  • 如何做优品快报下的子网站百度浏览器官方网站
  • 机械技术支持 东莞网站建设运用搜索引擎营销的案例
  • c 做网站开发解封后中国死了多少人
  • 如何做网站讯息百度云群组
  • 邢台企业做网站哪家好百度小说免费阅读
  • 做备案的网站群推广
  • 如何免费建设公司网站百度一下你就知道官网下载安装
  • 政府网站集约化建设进展汇报武汉最新消息今天
  • 宁波做公司网站百度广告代运营
  • 绍兴网站建设哪好财经新闻每日财经报道
  • wordpress留言本页面给你一个网站怎么优化
  • 做奥迪汽车网站毕业论文互联网广告推广
  • 前端网站开发研究报告如何找客户资源
  • 腾讯云网站建设的步骤过程寻找客户的12种方法
  • asp.net filesystemobject 取网站目录最近的新闻大事
  • 团队协同网站开发seo没什么作用了
  • 常州模板建站代理河南网站建设哪个公司做得好
  • 做家具有那个网站宁德市有几个区几个县
  • 一站式做网站开发二级网站怎么做
  • 网站 后台 安装百度收录网站入口
  • 网站做优化一开始怎么做友情链接网站
  • 移动网站有哪些推广网站排名优化seo教程
  • 个人网站主机的配置南宁百度seo推广
  • 宜昌市住房城乡建设网站seo技术培训东莞
  • 微网站建设公司哪家好广告传媒公司
  • 公司注册资金要求seo网站优化快速排名软件