2016-12-06 195 views
1

我正在使用extjs 6.0.2。我想根據窗口的大小調整標籤寬度。我該怎麼做,請幫助。我已經嘗試了下面的代碼,但沒有用。使用extjs根據窗口大小調整標籤寬度

{ 
      xtype : 'label', 
      itemId: 'recordNumberShowItem', 
      style: 'color: #707070; font-family: VegurMedium,sans-serif; font-size: 12px;', 
//   text: Ext.String.format(me.displayRecordNumberMsg, 0, 0, 0, me.recordName), 
      scope: me, 
      listeners : { 
       show : function (label , eOpts){ 
//     width: (window.outerWidth < 1350) ? 70 : 140, 
          if(window.outerWidth < 1350){ 
           label.setWidth(70); 
          } 
          else{ 
           label.setWidth(null); 
          } 
       } 
      } 
     } 

回答

0
Ext.create({ 
      xtype:'window', 
      width:200, 
      height:200, 
      resizable:true, 
      items:[ 
       { 
        xtype:'label', 
        width:'100%', 
        style:' word-wrap: break-word;', 
        text:'dawbnduiawbndawbduibdwuiabduiw' 
       }] 
     }).show(); 

這裏是你一個小提琴:https://fiddle.sencha.com/#view/editor&fiddle/1lv3

相關問題