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

templatable.js中compile方法建议 #34

Closed
nuintun opened this issue Mar 26, 2013 · 6 comments
Closed

templatable.js中compile方法建议 #34

nuintun opened this issue Mar 26, 2013 · 6 comments

Comments

@nuintun
Copy link

nuintun commented Mar 26, 2013

templatable.js中compile方法中下段代码

template || (template = this.template)
model || (model = this.model)

建议修改成下面的样子

template = template || this.get('template')
model = model || this.get('model')

原来的代码在

this.set('model', {})

后在_onChangeModel调用

this.compile();

model还是初始化时候的model

@lifesinger
Copy link
Member

感谢反馈,这个会在接下来的修改中修改掉

@popomore
Copy link
Member

代码初始化的时候会将 template、model 等挂在 this 上,不会再操作 attrs 上的值了。

https://github.com/aralejs/widget/blob/1.0.3/src/widget.js#L25

可以这么操作

this.model = {}
this.complile();

@nuintun
Copy link
Author

nuintun commented Mar 27, 2013

@popomore model是数据层,当重新设置model的时候element应该自动更新,如果初始话就挂在this上,不再操作感觉不是很合理。

@popomore
Copy link
Member

现在更新的方式是

this.model = {};
this.renderPartial();

这个我们内部讨论下再确定方案

@nuintun
Copy link
Author

nuintun commented Mar 27, 2013

@popomore ok~

@popomore
Copy link
Member

popomore commented Apr 2, 2013

准备去除 renderPartial ,新写法关注 #33

@popomore popomore closed this as completed Apr 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants