简体   繁体   English

从jQuery迁移到Zepto

[英]migrate from jQuery to Zepto

im using many plugins in jQuery... 我在jQuery中使用了很多插件......

im trying to migrate to Zepto and i have this problem 我试图迁移到Zepto,我有这个问题

Uncaught TypeError: Object function (a,b){return A.init(a,b)} has no method 'data' 

in console 在控制台

$.data
undefined

in my html(im using jade compiler) 在我的HTML(即时使用玉编译器)

script(src="/javascripts/assets/zepto/zepto.min.js")
script(src="/javascripts/assets/zepto/data.js")
script
    Zepto.browser = {webkit: true}
    window.jQuery = Zepto

and im still gettin this 我仍然开始这个

Uncaught TypeError: Object function (a,b){return A.init(a,b)} has no method 'data' 
$.data
undefined

this is the data.js data.js and this is github Zepto 这是data.js data.js ,这是github Zepto

anybody can explain me what's wrong??? 任何人都可以解释我的错误???

jQuery has a jQuery.data function , which Zepto doesn't seem to have. jQuery有一个jQuery.data函数 ,Zepto似乎没有。 This should work as an implementation: 这应该作为一个实现:

$.data = function(elem, key, value){
    return $(elem).data(key, value);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM