Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于getter方法 #74

Open
Tonyhark opened this issue Apr 8, 2014 · 1 comment
Open

关于getter方法 #74

Tonyhark opened this issue Apr 8, 2014 · 1 comment

Comments

@Tonyhark
Copy link

Tonyhark commented Apr 8, 2014

http://aralejs.org/widget/examples/simple-tabview.html
js代码如下:

getter: function(val) {
return this.$(val);
}

这里的 $(val) 就是 $('.nav li')
经过测试发现 this.$(val) 就变成 $('#demo .nav li') 了,这个是如何实现的?我查看了base.js 的源码但是还没明白,用this.$(val) 这个写法是为了增加$('.nav li') 的特殊性吗?
$('#'demo') 就是和实例对象相关联的elements

@afc163
Copy link
Member

afc163 commented Apr 8, 2014

this.$ 相当于 this.element.find

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants