<template>
<view class="uni-wechat:flex uni-wechat:flex-col uni-wechat:gap-2">
<wd-swipe-action v-model="action[value]" v-for="value in sources" :key="timeStamp">
<view>
{{value}}
</view>
<template #right>
<wd-button :custom-class="'uni-wechat:h-full!'" type="error" :round="false" @click="() => onAction(value)">
删除
</wd-button>
</template>
</wd-swipe-action>
</view>
</template>
<script setup lang="ts">
const sources = computed<number[]>(() => [1,2,3]);
const action = ref<'right' | 'close'>({});
const onAction = (_v: number) => {
action.value[_v] = 'right';
console.log(_v, 33)
}
watch(() => sources.value, (_sources) => {
action.value = _sources.reduce((acc: any, cur: number) => {
acc[cur] = 'close'
return acc;
}, {})
}, { deep: true, immediate: true })
</script>
Wot UI 版本号
1.14.0
平台
微信小程序
复现Demo地址(如不提供,将被直接关闭)
创建超时,只能在步骤提供源码
重现步骤
期望的结果是什么?
点击onAction,只触发点击事件,滑块不关闭,滑块的关闭由v-model的值控制
实际的结果是什么?
点击onAction,只触发点击事件,滑块关闭
环境信息
No response
其他补充信息
No response