uniGUI学习之脱离Delphi直接写ExtJS从入门到精通081ExtJs学习之Button.setStyle

发布时间 2024-01-04 11:14:37作者: 涂磊

最少代码:HelloWorld.html源文件下载 

https://docs.sencha.com/extjs/6.7.0/classic/Ext.button.Button.html

点击 事件

<link  rel="stylesheet" href="theme-gray-all.css">
<script src="ext-all.js"></script>   
<script>Ext.onReady(function () { /*---------------------------------------------------------------------------------*/

     Ext.create('Ext.panel.Panel', { 
            renderTo: 'helloWorldPanel',
            height: 200,
            width: 600,
            title: 'Hello world',
            
                items: [{ xtype  : 'button',text: '测试2'  
                       //  ,style:{ color:'blue'  }  // 会被  theme-gray-all.css 覆盖掉,去 掉theme-gray-all.css,就有用
                         ,handler: function() {Ext.get( 'helloWorldPanel').setStyle({"background-color":'blue'});}
                           }
                 ]

      });

}); </script><!------------------------------------------------------------------------------------------------------->

<div id="helloWorldPanel" />  <!--调用-->