本文介绍了如何在Polymer中获取查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
反正有没有办法在Polymer中获取查询字符串?
Is there anyway how can I get query string in Polymer?
http://localhost:8080/search?param=ppshein
我想在Polymer中获得search?param=ppshein
或param=ppshein
.
I want to get search?param=ppshein
or param=ppshein
in Polymer.
我试图在app-route
中获取查询字符串,但是它什么也不显示.
I've tried to get query string in app-route
but it display nothing.
<app-route
route="[[route]]"
pattern="/:id"
data="{{routeData}}"></app-route>
[[routeData.id]] **
推荐答案
您可以使用 <app-location>.queryParams
:
You could use <app-location>.queryParams
:
<app-location route="{{route}}" query-params="{{queryParams}}"></app-location>
queryParams
是一个对象,其中包含已解析查询参数的键/值对.给定http://localhost:8080/search?param=ppshein
,queryParams
将为:
queryParams
is an object containing key/value pairs of the parsed query parameters. Given http://localhost:8080/search?param=ppshein
, queryParams
would be:
{
param: 'ppshein'
}
这篇关于如何在Polymer中获取查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!