1. 自定义事件的命名空间 
jq的时间命名空间是用点“.”,而zepto是用冒号“:” 
如 

//jquery
$(this).trigger('cusevent.pluginname');
//zepto
$(this).trigger('cusevent:pluginname');

 

2、data() 方法 
jq的data方法非常强大,可以存储字符串、对象、函数等一切js数据 
而zepto的data方法相对要少一些:官方文档为:Zepto's basic implementation of `data()` only stores strings. To store arbitrary objects, include the optional "data" module in your custom build of Zepto.

翻译过来就是:Zepto的基本实现` data() `只存储字符串。存储任意对象,包括在您的自定义可选的“数据”模块建立Zepto。

由于写插件时,常用data方法来缓存插件实例化后的内容。 

 

相关文章:

  • 2021-09-14
  • 2021-07-31
  • 2021-08-04
  • 2022-02-21
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2021-11-25
  • 2021-06-17
  • 2021-06-24
  • 2022-12-23
相关资源
相似解决方案