问题:
刚开始更新我的高分子PWA到聚合物版2 现在得到同样的错误每个元素在控制台并没有什么负载。
遗漏的类型错误:类扩展未定义值不是一个构造函数或空
类似的问题,有一些东西需要用循环依赖,但我真的不知道为什么会这样,什么确切含义,以及如何解决它。也许有人可以在这里澄清事情!?
理念:
我可能会使用某种聚合物2 &的搭配的是混合模式,因为我仍然使用DOM,如果和进口bower_components /聚合物/ lib中/元/ DOM-if.html
不过,我不认为这是导致错误的控制台点
类MyApp的扩展Polymer.Element聚合物2 +火力地堡:类型错误类扩展值undefined,而不是一个构造函数或空
例1:
<!-- import CSS mixin shim -->
<link rel="import" href="bower_components/shadycss/apply-shim.html">
<!-- import custom-style -->
<link rel="import" href="bower_components/polymer/lib/elements/custom-style.html">
<!-- import template repeater -->
<link rel="import" href="bower_components/polymer/lib/elements/dom-if.html">
<link rel="import" href="bower_components/polymer/polymer-element.html">
<!-- Polymer Imports -->
<link rel="import" href="bower_components/polymer/polymer.html">
<!-- CustomElements -->
<link rel="import" href="src/customElements/custom-icons.html">
<link rel="import" href="my-landingpage.html">
<link rel="import" href="my-yole.html">
<dom-module id="my-app">
<template>
<style>
:host > * {
display: block;
}
</style>
<template is="dom-if" if="[[!user]]">
<my-landingpage></my-landingpage>
</template>
<template is="dom-if" if="[[user]]">
<my-yole></my-yole>
</template>
</template>
<script>
class MyApp extends Polymer.Element {
static get is() { return 'my-app'; }
}
customElements.define(MyApp.is, MyApp);
</script>
</dom-module>
例2相同的错误:
<!-- import CSS mixin shim -->
<link rel="import" href="../../bower_components/shadycss/apply-shim.html">
<!-- import custom-style -->
<link rel="import" href="../../bower_components/polymer/lib/elements/custom-style.html">
<link rel="import" href="../../bower_components/polymer/polymer-element.html">
<!-- Polymer Imports -->
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/app-layout/app-grid/app-grid-style.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="custom-icons.html">
<!-- Custom Elements & Style -->
<dom-module id="my-footer">
<template>
<style include="app-grid-style">
:host > * {
display: block;
--app-grid-columns: 3;
--app-grid-gutter: 24px;
}
</style>
<div>
<ul id="footer" class="app-grid">
<li>Terms of use</li>
<li>
<a href="https://www.facebook.com">
<iron-icon icon="custom-icons:facebook"></iron-icon>
</a>
<a href="https://www.instagram.com">
<iron-icon icon="custom-icons:instagram"></iron-icon>
</a>
</li>
<li on-tap="openPolicy">Privacy Policy</li>
</ul>
</div>
<paper-dialog id="policyDialog" with-Backdrop>
<h2>Privacy Policy</h2>
<h2>Privacy Policy for yogiyolie.com </h2>
</paper-dialog>
</template>
<script>
class MyFooter extends Polymer.Element {
static get is() { return 'my-footer'; }
constructor() {
super();
}
connectedCallback() {
super.connectedCallback();
this._updateGridStyles = this._updateGridStyles || function() {
this.updateStyles();
}.bind(this);
window.addEventListener('resize', this._updateGridStyles);
}
disconnectedCallback() {
super.disconnectedCallback();
window.removeEventListener('resize', this._updateGridStyles);
}
openPolicy() {
this.$.policyDialog.toggle();
}
}
customElements.define(MyFooter.is, MyFooter);
</script>
</dom-module>
你可以检查你的'bower.json'中的聚合物是什么版本吗? – Ofisora
我删除了所有组件并安装了“聚合物”:“聚合物/聚合物#^ 2.0.0”但是,我确实遇到了3个冲突,因此我以最新版本为前缀并将其添加到我在bower.json中的解决方案中。 – Niklas