现在的位置: 首页 > 综合 > 正文

sencha touch2使用define定义视图与create的差异

2018年01月29日 ⁄ 综合 ⁄ 共 935字 ⁄ 字号 评论关闭

Ext.define('App.view.Login',{
    extend:'Ext.form.Panel',
    alias:'widget.login',
    requires:['Ext.field.Text'],
    /*fullscreen:true,*/
    initialize:function(){
        /*this.callParent();*/

        var txt={
            xtype:'textfield',
            name:'name',
            placeHolder:'用户名'
        };

        var pwd={
            xtype:'passwordfield',
            name:'password',
            placeHolder:'密码'
        };

        this.add([
            txt,
            pwd
        ])
    },

    style:'background-color:red;',
    config:{
        /*fullscreen:true,*/
        /*scrollable:'vertical'*/
        /*items:[
            {
                xtype:'textfield',
                name:'name',
                placeHolder:'用户名'
            },
            {
                xtype:'passwordfield',
                name:'password',
                placeHolder:'设置密码'
            }
        ]*/
    }
    /*使用define定义视图的时候不能直接把items:[]放在与config同一层次,有两种方式:(1)放在config;(2)在initialize函数中定义好每个组件后添加*/

})

 

抱歉!评论已关闭.