当前位置: 首页 > 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/37991.html

相关文章:

  • 深圳民治网站建设广州十大营销策划公司
  • 网站制作详细教程肇庆网站建设
  • 关键词排名优化公司哪家好seo全网推广营销软件
  • 免费asp企业网站源码企业全网推广
  • 做网站用那个浏览器中国seo第一人
  • 公司网站服务器租用威海网站制作
  • 企业网站cms模板东莞做网站的公司有哪些
  • 美女写真网站源码做关键词优化
  • 网站开发算什么费用东莞做网站哪家好
  • 山西省智慧建筑信息平台seo服务外包公司
  • 免费网页申请谷歌优化排名公司
  • 网站建设首选亿企联盟腾讯广告推广怎么做
  • 做苗木网站哪家做得好seo关键词排名优化如何
  • 做信息图的免费网站seo技术网网
  • 网站优化方案 site ww广告接单平台有哪些
  • 福州网站建设个人兼职yoast seo教程
  • 网站的栏目青岛官网seo
  • 高端大气网络设计建设公司网站织梦模板怎么做seo信息优化
  • 武汉经济技术开发区官网广东百度seo
  • wordpress学做网站站长工具ip查询
  • 郑州营销网站公司地址优化网站排名需要多少钱
  • 国家企业信用信息没有网站怎么做google搜索入口
  • java和php做网站海南网站设计
  • 网站 只做程序长春做网站公司长春seo公司
  • 城市建设杂志社网站seo技术论坛
  • 海南爱心扶贫网站是哪个公司做的百度一下网页首页
  • 科技有限公司可以做网站建设吗?全球搜索网站排名
  • 在四川省住房和城乡建设厅网站上查代做百度首页排名价格
  • 渠道营销包括哪些方面宁波seo关键词优化方法
  • 网站模板建设上海百度seo网站优化