amis icon indicating copy to clipboard operation
amis copied to clipboard

link配置设置header

Open ForeverCm opened this issue 7 years ago • 5 comments

如下我给这个按钮配置了一个link进行跳转,但是跳转的时候希望请求中可以带一个header,里面进行一些设置,这个有办法吗? { type: "button", label: "书籍明细", actionType: "link", link: "http://127.0.0.1:8888/admin/customer/book?${tel}", }

ForeverCm avatar Nov 11 '19 08:11 ForeverCm

没懂你意思

你可能是想在跳转过去的页面中,请求接口里加自定义headers,这样加:

api:{
    url:'xxx',
    method: 'xxx',
    data:{
        xxx:'xxxx
    },
    headers:{ // 这里
        'some-header': 'xxx'
    }
}

RickCole21 avatar Nov 11 '19 08:11 RickCole21

你发的代码,是的api里面添加没问题。

我的问题是,我下面的link里面配置了一个请求http://127.0.0.1:8888/admin/customer/book?${tel} ,这个请求是打到后端服务里面的,现在可以通过${tel} 传递参数,相当于是在body里面。 有没有办法给 这个请求的headers里面设置东西

{ type: "button", label: "书籍明细", actionType: "link", link: "http://127.0.0.1:8888/admin/customer/book?${tel}", }

ForeverCm avatar Nov 11 '19 09:11 ForeverCm

no,页面跳转到地址是浏览器发起的请求,没办法控制 header

2betop avatar Nov 11 '19 09:11 2betop

可以link换成ajax,然后跟api一样配就行

如果你一定要跳转那没办法

RickCole21 avatar Nov 11 '19 09:11 RickCole21

好的,我试下多谢。

ForeverCm avatar Nov 11 '19 09:11 ForeverCm