baidu / baidu/amis

3.6.3中的crud组件使用时,switch开关操作请求接口,点击分页后,id发生错位

Open
#9,397 0 comments 0 reactions 0 assignees View on GitHub
need confirm
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

#### 描述问题:

crud组件使用时,switch开关操作请求接口,点击分页后,id传的是上一次的id

#### 截图或视频:
![image](https://github.com/baidu/amis/assets/156183775/38d271fe-cdd8-469b-ad5a-563a2d91aac3)

#### 如何复现(请务必完整填写下面内容):

1. 你是如何使用 amis 的?
直接git clone的源码

2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
3.6.3
3. 粘贴有问题的完整 `amis schema` 代码:
```
export default {
type: "page",
body: [{
type: "crud",
api: "https://mock.apifox.com/m2/3216308-0-default/140306868",
columns: [
{
label: "姓名",
name: "name"
},
{
label: "ID" ,
name: "id"
},
{
label:"状33态",
type:"switch",
trueValue: 2,
falseValue: 1,
name: "status",
id: "status",
onEvent: {
change: {
actions: [
{
actionType: "ajax",
args: {
api: {
method: "get",
url: "SERVICE_OCM/site/page/template/updateStatus?ids=${id}&status=${status}",
},
},
},
],
},
},
}
],

}
]

}
```

4. 操作步骤
请简单描述一下复现的操作步骤...
将此代码运行起来后,渲染出来内容,打开Network查看接口请求的ids和点击分页前后的的这一行的id是否对应的上

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided CRUD schema and reproduce the switch change before and after pagination while inspecting the Network request. Trace the switch change action and its `${id}` value; the fix is done when the request uses the ID of the row currently clicked on every page.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.