惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
G
Google Developers Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
F
Full Disclosure
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
C
Cisco Blogs
博客园 - 司徒正美
Project Zero
Project Zero
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
Scott Helme
Scott Helme
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
T
Threatpost
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
S
Security Archives - TechRepublic
博客园 - Franky
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
W
WeLiveSecurity
A
Arctic Wolf
B
Blog

博客园 - 宁#宁

【extjs6学习笔记】1.16 初始: 关于主题 【extjs6学习笔记】0.4 准备: 书籍与文档 【extjs6学习笔记】0.3 准备: 类库结构2 【extjs6学习笔记】1.13 初始: 模型 【extjs6学习笔记】1.15 初始: 关于build 【extjs6学习笔记】1.11 初始: config 【extjs6学习笔记】1.12 初始: Working with DOM 【extjs6学习笔记】1.10 初始: 定义类 【extjs6学习笔记】1.9 初始: Mixins 【extjs6学习笔记】1.8 初始: ExtJS命名约定 【extjs6学习笔记】1.7 初始:加载第三方库 - 宁#宁 【extjs6学习笔记】1.6 初始:本地化 【extjs6学习笔记】0.1 准备:基础概念(02) 【extjs6学习笔记】1.5 初始:关于布局 【extjs6学习笔记】1.4 初始:ajax请求django应用 【extjs6学习笔记】Mastering Ext JS, 2nd Edition 【extjs6学习笔记】1.3 初始:根据模板创建项目 【extjs6学习笔记】1.2 初始:MVC MVVM 【extjs6学习笔记】1.1 初始:创建项目
【extjs6学习笔记】1.14 初始: ViewModel
宁#宁 · 2017-06-08 · via 博客园 - 宁#宁

ViewModel是一个管理特定UI组件数据的类。 可以将其视为特定视图的记录容器。 它支持与UI组件的双向数据绑定,只要用户在视图中更改数据,它具有最新的副本。 与模型不同,它不能包含代理,因此它不能直接从远程服务器获取数据。

我们来创建一个带有虚拟数据的简单ViewModel并将其绑定到一个组件。 请考虑以下示例。

在上面的例子中,我们创建了简单的ViewModel类,名为MyApp.view.TestViewModelExt.app.ViewModel。别名配置用于给它一个简短的名称,以便我们可以在UI中使用这个简短的名称来查找它。数据配置用于提供样本数据对象。在这里,我们提供了idname属性的简单对象。 viewmodel类在使用viewmodel类型的viewModel配置的组件中引用。使用bind config将特定的UI配置值与ViewModel的数据绑定。在上面的例子中,组件的html属性用"test"viewmodel数据对象的idname属性绑定。使用大括号来绑定特定属性,如"{id}""{name}"。所以现在,上述组件将显示"1 - Steve"