polymer 你好,世界
示例
本示例创建一个名为的Polymer元素x-foo,其元素绑定到名为“message”的字符串属性。元素的HTML导入到主文档中,从而允许使用中的<x-foo>标记<body>。
x-foo.html
<dom-module id="x-foo">
<template>
<span>{{message}}</span>
</template>
<script>
Polymer({
is: 'x-foo',
properties : {
message: {
type: String,
value: "你好,世界!"
}
}
});
</script>
</dom-module>index.html
<head>
<!-- PolyGit used here as CDN for demo purposes only. In production,
it's recommended to import Polymer and Web Components locally
from Bower. -->
<base href="https://polygit.org/polymer+1.6.0/components/">
<script xx_src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="polymer/polymer.html">
<link rel="import" href="x-foo.html">
</head>
<body>
<x-foo></x-foo>
</body>参见CodePen中的演示