如图,在uview Checkbox 复选框的基础上,需要对每一项增加一个删除功能
<u-form-item
style="padding:0 40rpx;"
label="子任务"
prop="subtask"
>
<view style="display:flex;">
<view class="">
<u-checkbox-group
v-model="subTaskValue"
placement="column"
@change="checkboxChange"
>
<template v-for="(item, index) in subTaskCheckboxList" class="flex flex-wrap flex-jc-start flex-ai-start">
//在外层包裹一个template
<u-checkbox
:customStyle="{marginBottom: '8px',width:'650rpx'}"
:key="item.id"
:label="item.name"
:name="item.id"
>
</u-checkbox>
<view class="flex-jc-between flex" >
<span>
{{ item.time==''?'无':item.time + '截止' }}
</span>
<span>
{{ item.staffName==''?'无':item.staffName }}
</span>
<span style="color:red;" @click="delSubTask(item,index)">删除</span>
</view>
</template>
</u-checkbox-group>
<view class="addSubTask">
<u-tag text="新建子任务" size="mini" shape="circle" @click="()=>{createSubTaskShow=true;}"></u-tag>
</view>
</view>
</view>
</u-form-item>
版权声明:本文为weixin_43913004原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。