sencha touch2使用define定義視圖與create的差異

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函數中定義好每個組件後添加*/

})

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章