baidu / baidu/amis

tabs 选项卡组件内容页第一次渲染问题

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

Description

#### 当前方案:
第一部分代码是在第一个tab里面有一个表格,表格某一行的列上添加一个按钮,点击按钮激活另一个选项卡,并传递数据给service组件
```
"type": "button",
"icon": "fa fa-times text-danger",
"onEvent": {
"click": {
"actions": [

{
"componentId": "service-setvalue",
"actionType": "setValue",
"args": {
"value": {
"messageinfo": "${id}"
}
}
},
{
"actionType": "changeActiveKey",
"tooltip": "删除",
"componentId": "tabs-change-receiver",
"args": {
"activeKey": 3
}
}
]
}
}
```

第二部分代码是要上一步要打开的选项卡,并通过service获取数据,其中custom组件是vue开发的一个自定义组件,通过传递属性把 messageinfo属性传递到了自定义组件中
```
{
"key": 3,
"title": "流程信息",
"type": "service",
"id": "service-setvalue",
"name": "service-setvalue",
"data": {
"messageinfo":
"🇺🇸 美国"
},
"body": {
"type": "my-custom",
"name": "customvue",
"label": "自定义组件",
"id": "u:6a22dd5db3b1"

}
},
```
现在问题是这个第二部分的选项卡的在第一次展示的时候,没有根据第一部分选择数据变化,是获取的初始值,第二次重新点击的时候能获得传递过来的值

这个问题如何解决?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the tabs component's first activation and the changeActiveKey action using the configuration shown, then inspect how the service passes messageinfo into the custom Vue component. Reproduce the first-click and second-click behavior, and consider the issue done when the first display receives the selected value rather than the initial value.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.