1***@qq.com
1***@qq.com
  • 发布:2023-05-31 17:08
  • 更新:2023-12-27 14:38
  • 阅读:293

请问行怎么实现可以开关的按钮?

分类:uni-app

请问行怎么实现可以开关的按钮?

2023-05-31 17:08 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com

你直接去改他的底层代码就可以了 找到他项目示例代码里面的components/zb-table/zb-table.vue文件 第320行
加入一个slot插槽

<template v-else-if="ite.type==='slot'">  
   <slot :name="ite.name"></slot>  
</template>

然后在column里面加上

                    {  
                        name: 'key',  
                        label: '测试',  
                        type: 'slot',  
                    },

在组件里面 这样写 template #key 然后里面的内容就是自定义的了

                <zb-table ref="zbTable" @sort-change="sortChange" :pullUpLoading="pullUpLoading" :isShowLoadMore="true"  
                    :highlight="true" :show-header="true" :columns="column" :fit="false" :permissionBtn="permissionBtn"  
                    row-key="id" @rowClick="rowClick" @toggleRowSelection="toggleRowSelection"  
                    @toggleAllSelection="toggleAllSelection" :border="true" @custom="custom" @edit="buttonEdit"  
                    @dele="dele" :data="data">  
                    <template #key>  
                        <div style="color: red;">  
                            <image src="../../static/logo.png" style="width:20rpx; height: 20rpx" mode=""></image>  
                            1111  
                        </div>  
                    </template>  
                </zb-table>
昭昭L

昭昭L - 开心就好

uni-switch组件

要回复问题请先登录注册