【发布时间】:2016-04-25 14:19:18
【问题描述】:
有谁知道是否可以设置 Polymer iron-ajax 元素的 withCredentials 属性的默认值?
默认值为false,但我需要它为true(需要多次,我不想每次都写with-credentials="true")
【问题讨论】:
标签: javascript polymer polymer-1.0
有谁知道是否可以设置 Polymer iron-ajax 元素的 withCredentials 属性的默认值?
默认值为false,但我需要它为true(需要多次,我不想每次都写with-credentials="true")
【问题讨论】:
标签: javascript polymer polymer-1.0
您可以将iron-ajax 元素包装在另一个元素中。在新元素中公开iron-ajax 元素的所有属性。
这样您可以将属性设置为 true,当您需要 ajax 时,只需使用包装的 iron-ajax 元素。
【讨论】:
默认情况下 Polymer iron-ajax 元素 with-credentials 值为 false。
使用 with-credentials 将其设置为 true。
前任。
<iron-ajax id="abc" method="post" handle-as="json" with-credentials>
【讨论】: