我有一个简单的aap在聚合物2。它的工作完美,但当我添加元素从聚合物目录,然后我得到以下错误?还有纸输入没有正确显示?看看截图。一切都很完美我不知道为什么会突然发生这种事?
dom-module.html:136 Uncaught :未能在“CustomElementRegistry”上执行“定义”:此名称已与在 http://127.0.0.1:8000/components/polymer-todo/bower at http://127.0.0.1:8000/components/polymer-todo/bower的注册表一起使用
我的代码很简单
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../polymer/lib/elements/dom-repeat.html">
<link rel="import" href="bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="bower_components/paper-input/paper-input.html">
<dom-module id="polymer-todo">
<template>
<h3>Todo:</h3>
<dom-repeat
items="{{tasks}}"
as="task">
<template>
<div>
<paper-checkbox ></paper-checkbox>
<paper-input value="{{task}}"></paper-input>
</div>
</template>
</dom-repeat>
<button>Add task</button>
</template>
<script>
/**
* `polymer-todo`
* Simple to do to add Todos
*
* @customElement
* @polymer
* @demo demo/index.html
*/
class PolymerTodo extends Polymer.Element {
static get is() { return 'polymer-todo'; }
static get properties() {
return {
tasks: {
type: Array,
value: () => [1, 2, 3, 4, 5]
}
};
}
}
window.customElements.define(PolymerTodo.is, PolymerTodo);
</script>
</dom-module>

发布于 2018-10-04 21:15:18
我修好了。其实我变了
<link rel="import" href="bower_components/paper-checkbox/paper-checkbox.html">
等到
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
而且起作用了。
https://stackoverflow.com/questions/49941933
复制相似问题