Polymer Iron Ajax withCredentials 默认值

Polymer Iron Ajax withCredentials default value

有谁知道是否可以设置 Polymer iron-ajax 元素的 withCredentials 属性 默认值?

默认值为 false,但我需要它为 true(多次需要它,我不想每次都写 with-credentials="true")

您可以将 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>