博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
polymer中的notify和reflectToAttribute
阅读量:6983 次
发布时间:2019-06-27

本文共 1065 字,大约阅读时间需要 3 分钟。

hot3.png

notify and reflectToAttribute. The notify and reflectToAttributeproperties may sound similar: they both make the element's state visible to the outside world. reflectToAttribute makes the state visible in the DOM tree, so that it's visible to CSS and thequerySelector methods. notify makes state changes observable outside the element, either using JavaScript event handlers or Polymer .

用实例演示一下两者的区别。以下代码仅适用于polymer 1.0。

icon-toggle.html 

icon-toggle-demo.html

测试页面:

              

执行效果:

093749_DmVZ_2391658.png

效果影响:

1、如果在icon-toggle中去除:reflectToAttribute: true,则点击图标时,填充效果将无效,但msg效果是有效的,即仍会在:You really like me! 和 Do you linke me?之间切换。

2、如果去除:notify: true 属性,则填充效果有效,但msg的切换效果则会消失。

转载于:https://my.oschina.net/u/2391658/blog/1113886

你可能感兴趣的文章
HDU 1052 - Tian Ji -- The Horse Racing
查看>>
【NOIP】提高组2012 同余方程
查看>>
RvmTranslator7.1
查看>>
ReentrantLock与synchronized
查看>>
TCP
查看>>
爬虫基本原理
查看>>
2_1_6 递归与分治策略(汉诺塔问题)
查看>>
AtCoder Regular Contest 082
查看>>
实验一
查看>>
javascript核心
查看>>
CSS三大特性:层叠性、继承性、优先级
查看>>
组件的创建方式1
查看>>
Net基础复习
查看>>
自怨自艾和怨天尤人
查看>>
uva 515 King
查看>>
Quartz实现定时任务实例
查看>>
python爬虫的scrapy安装+pymongo的安装
查看>>
webservice gsoap 小记
查看>>
TesCase-GUI(图形用户界面)测试
查看>>
自问自答 学习系列(1):从图像分类,到损失函数,到神经网络
查看>>