Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwipeCell 滑动,请问这个确认删除是怎么实现的呢?文档实在每看明白 #3030

Closed
luoxin59420 opened this issue Jul 31, 2024 · 5 comments
Labels
question This is a question, not a bug

Comments

@luoxin59420
Copy link

image

Copy link
Contributor

👋 @luoxin59420,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@jarmywang jarmywang added the question This is a question, not a bug label Jul 31, 2024
@jarmywang
Copy link
Collaborator

jarmywang commented Jul 31, 2024

@luoxin59420 配合opened属性,第一次点击删除把right改为只有一个确认删除,opened改为true,再次点击删除才删除

@luoxin59420
Copy link
Author

image

@luoxin59420 配合opened属性,第一次点击删除把right改为只有一个确认删除,opened改为true,再次点击删除才删除

点击第一个删除后,设置opened为true,但滑块还是关闭了,需要二次滑动才显示刚才显示的,是跟下面的有关系吗、
image

@jarmywang
Copy link
Collaborator

@luoxin59420 没关系,贴一下你代码?

@luoxin59420
Copy link
Author

@luoxin59420 没关系,贴一下你代码?
openCell: [false, false, false],
right: [
[{
text: '重命名',
className: 'btn edit-btn',
},
{
text: '删除',
className: 'btn delete-btn',
},],
[{
text: '重命名',
className: 'btn edit-btn',
},
{
text: '删除',
className: 'btn delete-btn',
},],
[{
text: '重命名',
className: 'btn edit-btn',
},
{
text: '删除',
className: 'btn delete-btn',
},]
],

// 滑块
async onActionClick ({ detail, currentTarget }) {
const { index, row } = currentTarget.dataset
// 删除
if (detail.text === '删除') {
await this.setData({
[right[${index}]]: [{ text: '确认删除', className: 'btn-confirm-del delete-btn' }],
[openCell[${index}]]: true
})
}
// 重命名
if (detail.text === '重命名') {
await this.setData({ showWithRename: true, isRename: true, currentMyDevice: row })
}
// 真正删除
if (detail.text === '确认删除') {
this.confirmDialogDel(row)
}
},
现在换种方式写,可以弹出确认删除了,但是有个新问题:当右滑关闭滑块的时候,需要还原初始化的两个按钮,目前监听不到滑块关闭,请帮忙看下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question, not a bug
Projects
None yet
Development

No branches or pull requests

2 participants