【发布时间】:2017-12-21 00:52:50
【问题描述】:
我已经声明了这样一个属性:
static get properties() {
return {
auth1: {
type: Boolean,
readonly: false,
value: false,
notify: true
}
};
}
在我的 Polymer 元素中。现在我有了这个功能:
connect(){
this.auth1.value = true;
console.log("Authenticated" + this.authenticated);
}
这应该将属性值更改为 true。每次我调用该函数时,我都会遇到错误“TypeError: Attempted to assign to readonly property.”。但是我在我的属性中将 readonly 设置为 false 。我的函数是用这样的按钮调用的:
<button id="loginbutton" on-tap="connect">Click me!</button>
有人可以帮助我吗?
【问题讨论】:
-
一件事:O应该大写:readOnly: false
-
感谢您的提示!
标签: javascript properties polymer polymer-2.x polymer-elements