polymer为元素的原型添加可执行方法

原创
2017/07/02 11:07
阅读数 76
Polymer({
    is: 'cat-element',
    _says: 'meow',
    speak: function() {
      console.log(this._says);
    }
});

使用方法:
var cat1 = document.querySelector('cat-element');
cat1.speak();
var cat2 = document.createElement('cat-element');
cat2.speak();

绑定css或class属性:

Class and attribute manipulation

CSS transforms

  • transform(transform, [node]). Applies a CSS transform to the specified node, or host element if no node is specified. transform is specified as a string. For example:

     this.transform('rotateX(90deg)', this.$.myDiv);
    
  • translate3d(x, y, z, [node]). Transforms the specified node, or host element if no node is specified. For example:

    this.translate3d('100px', '100px', '100px');
展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部