首页 > 其他 > 详细

[Polymer] Introduction

时间:2015-12-22 06:26:11      阅读:181      评论:0      收藏:0      [点我收藏+]

install Polymer and explore creating our first custom element:

 bower install polymer

 

index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Polymer</title>
    <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
    <link rel="import" href="bower_components/polymer/polymer.html">
    <link rel="import" href="./hello-world.html">
</head>
<body>
<hello-world name="ZTW"></hello-world>
</body>
</html>
  • include webcomponents-list.js file
  • import polymer.html file
  • import our compoment hello-world.html file

 

hello-world.html:

<dom-module id="hello-world">
    <template>
        <input type="text" value="{{name::keyup}}"> <!-- {{}} two way data binding, ::bind to event -->
        <h1>Hello, [[name]]</h1> <!-- [[]] one way data binding -->
    </template>
    <script>
        Polymer({
            is: "hello-world"  // string match the tag
        })
    </script>
</dom-module>

 

[Polymer] Introduction

原文:http://www.cnblogs.com/Answer1215/p/5065447.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!