問題:
剛開始更新我的高分子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