Javascript 在polymer 1.0中,在自定义元素中导入polymer按钮会出现错误
我已经编写了一个简单的聚合自定义元素,希望在其中使用Javascript 在polymer 1.0中,在自定义元素中导入polymer按钮会出现错误,javascript,polymer-1.0,paper-elements,Javascript,Polymer 1.0,Paper Elements,我已经编写了一个简单的聚合自定义元素,希望在其中使用paper按钮元素。我的代码如下所示: <link rel="import" href="bower_components/Polymer/polymer.html"> <link rel="import" href="bower_components/paper-button/paper-button.html"> <dom-module id='chart-label'> <template
paper按钮
元素。我的代码如下所示:
<link rel="import" href="bower_components/Polymer/polymer.html">
<link rel="import" href="bower_components/paper-button/paper-button.html">
<dom-module id='chart-label'>
<template is="dom-bind">
<template is="dom-repeat" items="{{lables}}">
<input type=checkbox checked="true" id="checkb" value={{item}} name="check" on-change="checkChanged"><b>{{item}}</b>
</template>
</template>
<script>
Polymer({
is: 'chart-label',
buttonStates: [],
properties: {
buttonstates: {
type: Array,
value: [],
notify: true,
},
lables:Array
},
ready: function () {
for (var i = 0; i < this.lables.length; i++) {
this.buttonstates.push(true);
}
},
checkChanged: function (e) {
var it = e.model.item;
var index = this.lables.indexOf(it);
console.log(index + " index checked");
if (e.target.checked) {
this.buttonstates[index] = true;
} else {
this.buttonstates[index] = false;
}
// for (var i = 0; i < this.lables.length; i++) {
// alert(this.buttonstates[i]);
// }
//console.log("this.buttonstates"+this.buttonstates);
this.fire('checked',this.buttonstates);
}
});
</script>
</dom-module>
{{item}}
聚合物({
是:'图表标签',
按钮状态:[],
特性:{
按钮说明:{
类型:数组,
值:[],
通知:正确,
},
标签:数组
},
就绪:函数(){
对于(var i=0;i
当我尝试测试此代码时,它失败并出现以下错误:
未捕获的NotSupportedError:未能对“文档”执行“registerElement”:类型“dom模块”的注册失败。已注册具有该名称的类型
我错过了什么
注意我正在Polymer 1.0上编写此代码**我把代码中的Polymer版本弄乱了。我在一起构建新应用程序后修复了它。我把代码中的聚合物版本弄乱了。我在一起构建新应用程序后修复了它