聚合物0.8“未捕获的参考错误:聚合物未定义". [英] Polymer 0.8 "Uncaught ReferenceError: Polymer is not defined"
问题描述
最近,我对Polymer 0.8进行了决策测试,而不是仅仅阅读它,但是我遇到了一个错误:未捕获的ReferenceError:Polymer未定义".
我觉得这很简单,我想念我似乎无法弄清楚.
下面是我从 谢谢. 相反,您应该在添加了Polyfill的地方添加聚合物库. 下面是示例代码: Recently I made the decision test out Polymer 0.8 rather than just read about it, however I've come across an error: "Uncaught ReferenceError: Polymer is not defined". I have a feeling it's something really simple that I've missed I can't seem to figure it out. Below is my code which I've literally copied and pasted from the feature overview document: Thanks in advance. Instead you should add the Polymer Library where you have added the Polyfill. Below is an example code:
这篇关于聚合物0.8“未捕获的参考错误:聚合物未定义".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!webcomponents-lite.min.js
是Shadow DOM
和html Imports
的Polyfill,您应该将此添加到main.html
页面中,而不是添加到自定义组件中. /p>
<link rel="import" href="/bower_components/polymer/polymer.html">
<dom-module id="element-name">
<style>
/* CSS rules for your element */
</style>
<template>
<!-- local DOM for your element -->
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<dom-module id="element-name">
<style>
/* CSS rules for your element */
</style>
<template>
<!-- local DOM for your element -->
<div>{{greeting}}</div> <!-- data bindings in local DOM -->
</template>
</dom-module>
<script>
// element registration
Polymer({
is: "element-name",
// add properties and methods on the element's prototype
properties: {
// declare properties for the element's public API
greeting: {
type: String,
value: "Hello!"
}
}
});
</script>
<element-name></element-name>
webcomponents-lite.min.js
is the Polyfill for Shadow DOM
and html Imports
you should add this to you main.html
page and not in your custom component.<link rel="import" href="/bower_components/polymer/polymer.html">
<dom-module id="element-name">
<style>
/* CSS rules for your element */
</style>
<template>
<!-- local DOM for your element -->