extJs之application

一个Ext.app.Application代表一个整体的应用,需要为它绑定一些组件,如Views,Models,Controllers

Ext.application({
    name:'Blog',//a blog application
    models:['Posts','Comments'],
    controllers:['Posts','Comments'],

    launch:function(){}
});

Views一般不直接绑定在Application上,因为它是被Controllers管理的,所以一般创建Controllers的时候绑定Views。

Ext.define('MyApp.controller.Posts',{
    extend:'Ext.app.Controller',
    views:['posts.List','posts.Edit'],

    //the rest of controller here 
});

常用配置选项:
appFolder:String
the path to the directory which contains all application’s classes.
包含应用所有class文件的目录路径。默认为“app”。

autoCreateViewport:Boolean
true to automatically load and instantiate AppName.view.Viewport before firing the launch function.
在launch定义的函数执行之前,真正的自动加载和实例化AppName.view.Viewport。默认为false

defaultUrl:String
when the app is first loaded,the Url will be redirected to.
应用第一次加载时,该URL将会被重定向。

id:String
the id of this controller,you can use this id when dispatching.
controller的Id,请求转发的时候使用。

models:String[]
Array of models to require from appName.model namespace,for example:
models的数组值需要来自appName.model命名空间,例如:

Ext.define('MyApp.controller.Foo',{
    extend:'Ext.app.Controller',
    models:['User','Vehicle']
});

This is equivalent of:
这相当于:

Ext.define('MyApp.controller.Foo',{
    extend:'Ext.app.Controller',
    requires:['MyApp.model.User','MyApp.model.Vehicle']
});

name:String
The name of your application,this will also be the namespace of your views ,controllers,models and stores,dont’t use spaces or special characters in the name.
程序的名称,同时也是该程序下views,controllers,models,stores的命名空间目录。不能使用空格和特殊字符。

scope:Object
The scope to execute the launch function in,Defaults to the application instance.
launch函数的执行范围,默认本程序。

属性:
launch:Function
Called automatically when the page has completely loaded.This is an empty Function that should be overridden by each application that needs to take action on page load.
页面完全加载后执行。需要哪些想要页面加载后执行操作的程序覆盖。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值