SenCha Touch中Ext.create()和Ext.define()有什么区别 [英] What are differences between Ext.create() and Ext.define() in SenCha Touch
本文介绍了SenCha Touch中Ext.create()和Ext.define()有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我学习SenCha Touch已有一段时间了,但在尝试创建商店时仍然感到困惑.
I have been learning SenCha Touch for awhile and still feel confused when trying to create a store.
在SenCha文档中,它说使用Ext.create()示例 我尝试过,但是根本行不通.
In the SenCha Documentation, it says to use Ext.create() Example I tried and it simply doesn't work.
对于其他人,我总是看到人们使用Ext.define()创建商店,并且可以正常工作.
For the rest of others, I always see people use Ext.define() to create a store and it works.
现在,我的问题是: 它们之间有什么区别?何时/如何正确使用它们中的任何一个?
Now, my question is: what are the differences between them and when/how to use either one of them in a right way?
一些演示代码受到高度赞赏
Some demo code is highly appreciated
非常感谢我的朋友们.
推荐答案
define
用于声明一个类.
Ext.define('Foo', {
extend: 'Bar'
});
// Similar to:
public class Foo : Bar {
}
create
用于创建实例:
var o = Ext.create('Foo'); // Can also have var o = new Foo();
// Similar to:
Foo o = new Foo();
这篇关于SenCha Touch中Ext.create()和Ext.define()有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文