Polymer 1.x:获取自定义元素以在 Plunker 中说 HELLO WORLD
Polymer 1.x: Getting custom element to say HELLO WORLD in Plunker
In this Plunk, why won't the x-foo
element render HELLO WORLD?.
考虑到更复杂的 content-el
似乎完全正确地导入了 iron-data-table
。我忽略了一些简单的事情吗?请用一个工作plunk回答。
http://plnkr.co/edit/p7IE7v6DHLVnEggeO8PF?p=preview
<base href="https://polygit.org/polymer/components/">
<link rel="import" href="polymer/polymer.html">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<dom-module id="x-foo">
<template>
<style></style>
HELLO WORLD
</template>
<script>
(function() {
'use strict';
Polymer({
is: 'x-foo',
});
})();
</script>
</dom-module>
您会注意到浏览器控制台显示:
https://polygit.org/polymer/components/polymer/polymer.html Failed to load resource: the server responded with a status of 400 ()
https://polygit.org/polymer/components/webcomponentsjs/webcomponents-lite.min.js Failed to load resource: the server responded with a status of 400 ()
x-foo.html:14 Uncaught ReferenceError: Polymer is not defined
浏览器找不到所需的 Polymer 导入,因为您的 <base>
URL 在 x-foo.html
:
中的 polygit 配置格式错误
<base href="https://polygit.org/polymer/components/">
预计 URL format polygit.org
:
<server-name>/[<configurations>/]components/<component>/<path>
其中 <configurations>/
是:
<component>[+<org>]+<ver>|:<branch>|*
因此您的 <base>
URL 应该是以下任何一项:
<base href="https://polygit.org/components/">
<base href="https://polygit.org/polymer+:master/components/">
<base href="https://polygit.org/polymer+v1.7.0/components/">
In this Plunk, why won't the x-foo
element render HELLO WORLD?.
考虑到更复杂的 content-el
似乎完全正确地导入了 iron-data-table
。我忽略了一些简单的事情吗?请用一个工作plunk回答。
<base href="https://polygit.org/polymer/components/">
<link rel="import" href="polymer/polymer.html">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<dom-module id="x-foo">
<template>
<style></style>
HELLO WORLD
</template>
<script>
(function() {
'use strict';
Polymer({
is: 'x-foo',
});
})();
</script>
</dom-module>
您会注意到浏览器控制台显示:
https://polygit.org/polymer/components/polymer/polymer.html Failed to load resource: the server responded with a status of 400 ()
https://polygit.org/polymer/components/webcomponentsjs/webcomponents-lite.min.js Failed to load resource: the server responded with a status of 400 ()
x-foo.html:14 Uncaught ReferenceError: Polymer is not defined
浏览器找不到所需的 Polymer 导入,因为您的 <base>
URL 在 x-foo.html
:
<base href="https://polygit.org/polymer/components/">
预计 URL format polygit.org
:
<server-name>/[<configurations>/]components/<component>/<path>
其中 <configurations>/
是:
<component>[+<org>]+<ver>|:<branch>|*
因此您的 <base>
URL 应该是以下任何一项:
<base href="https://polygit.org/components/">
<base href="https://polygit.org/polymer+:master/components/">
<base href="https://polygit.org/polymer+v1.7.0/components/">