gpt4 book ai didi

polymer - app-location 删除查询字符串参数

转载 作者:行者123 更新时间:2023-12-02 04:34:42 24 4
gpt4 key购买 nike

我有一个非常简单的 polymer 2 应用程序,它使用 query 查询字符串参数。移动到 Polymer 2.0.1 和 app-location 2.0(而不是 rc 和预览版本),我注意到只要有一个 app-location 元素就会从 url 中删除所有查询字符串参数。

试试这个网址:https://api-1913.s3-eu-west-1.amazonaws.com/index.html?foo=bar ,并注意查询字符串在加载过程中是如何被删除的。

这是所有的代码:index.html:

<!DOCTYPE HTML>
<script src="/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="/my-app.html">
<html>
<head>
</head>
<body>
<my-app></my-app>
</body>
</html>

我的应用程序.html:

<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/app-route/app-location.html">

<dom-module id="my-app">
<template>
<app-location></app-location>

<h1>Coin</h1>
</template>
<script>
class App extends Polymer.Element{
static get is(){return 'my-app'}

ready(){
super.ready()
console.log('ready')
}
}
customElements.define(App.is, App)
</script>
</dom-module>

指定 query-params 属性以将其映射到 App 的属性不会改变任何内容。删除 app-location 元素并保留查询字符串。
有人见过这种行为吗?是否有任何解决方法 - 除了回滚到以前的版本?

最佳答案

这是一个错误。在修复发布之前,您可以暂时删除 iron-location 元素中的默认值。

要删除的行

value: function() {
return {};
}

受影响的属性(property)

   paramsObject: {
type: Object,
notify: true,
value: function() {
return {};
}
},

引用: https://github.com/PolymerElements/iron-location/pull/86/commits/3732e93ce2197178f76c3c2073438b9cd15096b4

关于polymer - app-location 删除查询字符串参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44626739/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com