简体   繁体   English

如何使用backbone.js模型和视图

[英]How to use backbone.js model and views

I have a user table in which I have some field eg name, email, image etc. 我有一个用户表,其中我有一些字段,例如姓名,电子邮件,图像等。

I can load many user at a time, eg. 我可以一次加载许多用户,例如。 if there is a view for user 如果有用户的视图

<div>username
<img of user >
<email>
<user message>
</div>

So when I fetch the data of user from db and create the backbone.js model and create the different view from the user data like in profile edit, in small view, big view, and if i change a data of user, it should change in all views. 因此,当我从db获取用户的数据并创建backbone.js模型并从用户数据创建不同的视图时,如在配置文件编辑中,在小视图,大视图中,如果我更改用户的数据,它应该更改在所有观点中。

Actually I would like to see a similar example, or a way to know how it can be implemented. 其实我想看一个类似的例子,或者想知道如何实现它的方法。

Check out the official example application . 查看官方示例应用程序 Play with their GUI. 玩他们的GUI。

Then read the annotated source . 然后阅读带注释的源代码 Then read it again. 然后再读一遍。

You should now have an good idea about how to use backbone. 您现在应该对如何使用骨干有一个好主意。

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

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