Skip to content

🐛 [Bug]: SwipeCell组件禁止滑动失效 #760

@zhuaoshuai13

Description

@zhuaoshuai13

Which React Vant packages are impacted?

  • react-vant (React Vant core)
  • react-vant-icons(React Vant Icon)

What version of React Vant are you using?

3.3.5

Reproduce live demo(codesandebox or stackblitz)?

No response

Descripition

刚开始可以滑动

  1. 如果此时不进行任何操作,直接点击按钮切换禁止状态,SwipeCell可以根据期望紧张滑动。
  2. 如何此时去操作SwipeCell进行滑动操作,然后点击按钮切换禁止状态,可以发现SwipeCell依旧可以滑动

"use client"
import { useState } from "react"

import { SwipeCell, Button, Cell, Toast } from "react-vant"

const page = () => {
const [disabled, setDisabled] = useState(false)
return (


<SwipeCell
disabled={disabled}
onOpen={() => Toast.info("打开")}
onClose={() => Toast.info("关闭")}
rightAction={
<Button style={{ height: "100%" }} square type='danger'>
删除

}
>


<Button
onClick={() => {
setDisabled(!disabled)
}}
>
{!disabled ? "点击禁止" : "点击允许"}


)
}

export default page

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions