在使用amis默认的导航组件时候,如何切换页面 #11268
Replies: 1 comment
-
|
已解决. id取得格式有错误 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
需求导航组件里有多菜单,如用户管理,系统设置,其他设置等,点击其中一个菜单,在主页面区里显示对应的页面布局。有没有实现的例子?多谢!
由于导航组件的json代码,不能直接在site.json添加,故无法使用site那种点击菜单打开页面方式。尝试在点击菜单时候通过event.data.to或event.data.label去目标组件的url属性,但是一直不成功,页面显示返回不是json格式。如果url只设置成一个固定值是没问题的。
下面是菜单给变量赋值的json:
"onEvent": {
"click": {
"weight": 0,
"actions": [
{
"actionType": "setValue",
"componentId": "u:087a0e174ab0",
"args": {
"value": {
"url": "${IFS(event.data.label===用户管理,'/pages/user.json',event.data..label===系统设置,'/pages/setting.json')}"
}
}
},
{
"actionType": "reload",
"componentId": "contentService"
}
]
}
}
Beta Was this translation helpful? Give feedback.
All reactions