Skip to content

[Bug 上报] SwipeAction 的 right 插槽,已经设置了v-model的值,点击right插槽之后还是会关闭 #1479

Description

@Neno-Chen

Wot UI 版本号

1.14.0

平台

微信小程序

复现Demo地址(如不提供,将被直接关闭)

创建超时,只能在步骤提供源码

Image

重现步骤

<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>

期望的结果是什么?

点击onAction,只触发点击事件,滑块不关闭,滑块的关闭由v-model的值控制

实际的结果是什么?

点击onAction,只触发点击事件,滑块关闭

环境信息

No response

其他补充信息

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions