base-table 加入动态slot 流程 vue2
发布时间:2022-10-15 05:54:56 349 相关标签:
columns
{
title: '字段标题',
slot: 'yourSlotName',
minWidth: 50,
align: 'center'
},
组件内
props: {
columns: {
type: Array,
default () {
return []
}
},
mounted () {
this.getSlot()
data () {
return {
slotArr: [],
methods: {
getSlot () {
this.slotArr = []
this.columns.forEach(item => {
if (item.slot) {
this.slotArr.push(item.slot)
}
})
},
组件外部调用
<base-table>
<template slot-scope="{ row, index }"
slot="yourSlotName">
<Button type="text"
v-if="row.yourSlotName"
@click="showData(index)"
size="small">{{ row.yourSlotName}}</Button>
</template>
</base-table>
---------------------------------------------
生活的意义并不是与他人争高下,而在于享受努力实现目标的过程,结果是对自己行动的嘉奖。
↑面的话,越看越不痛快,应该这么说:
生活的意义就是你自己知道你要做什么,明确目标。没有目标,后面都是瞎扯!
新博客 https://www.VuejsDev.com 用于梳理知识点
文章来源: https://blog.51cto.com/u_15770151/5630437
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报