amis icon indicating copy to clipboard operation
amis copied to clipboard

请问 initApi 如果拿到地址栏上的参数 拼接到上去

Open zhao812 opened this issue 6 years ago • 9 comments

"initApi": "/api/getUser/$id" id 是网页地址栏上的?id=1

zhao812 avatar Aug 05 '20 10:08 zhao812

你的问题是啥

RickCole21 avatar Aug 05 '20 10:08 RickCole21

"tpl": "这是你刚刚新增的页面,id=${id}。" 页面上的?id=1 在body 中拿不到 "body": [ { "type": "tpl", "tpl": "这是你刚刚新增的页面,id=${id}。" } ]

zhao812 avatar Aug 05 '20 10:08 zhao812

发使用方法,以及完整配置schema

RickCole21 avatar Aug 05 '20 10:08 RickCole21

http://127.0.0.1:8001/#/page/2?id=86 image

zhao812 avatar Aug 05 '20 10:08 zhao812

很简单的一个配置 拿url 上的id参数

zhao812 avatar Aug 05 '20 10:08 zhao812

配置看起来没问题,console里有啥报错吗

RickCole21 avatar Aug 05 '20 11:08 RickCole21

大佬,控制台 没有报错。 amis 会自动拿url上的参数么?

zhao812 avatar Aug 05 '20 13:08 zhao812

https://baidu.github.io/amis/docs/concepts/datascope-and-datachain

地址栏里的参数应该可以通过数据链获取到的,你链接是啥

RickCole21 avatar Aug 05 '20 13:08 RickCole21

谢谢 大佬, 我这边看了render 方法的RootRenderProps参数, 已经解决了

zhao812 avatar Aug 06 '20 01:08 zhao812