文章目录
        
          
            
            
              typescript
              复制代码
              
            
          
          Button(label?:ResourceStr) // ResourceStr:可以是普通字符串,也可以是引用定义好的字符串
         
      
        
          
            
            
              typescript
              复制代码
              
            
          
          Button('文字按钮')
         
      
        
          
            
            
              typescript
              复制代码
              
            
          
          Button(){
	Image($r('app.media.search')).width(20).margin(10)
}
         
      2.添加属性和事件
        
          
            
            
              typescript
              复制代码
              
            
          
          Button('文字按钮')
	.width(100)
	.height(30)
	.type(ButtonType.Normal) // 按钮类型
	// 按钮类型 
	// Capsule:胶囊型按钮(圆角默认为高度的一半)
	// Circle:圆角按钮。
	// Normal:普通按钮(不带圆角)。
	.onClick(() => {
		// 处理点击事件
	})
         
      二.Slider滑动条组件
        
          
            
            
              typescript
              复制代码
              
            
          
          Silder(option?:SliderOptions) // SliderOptions为滑动条的配置属性
Slider({
	min:0, // 最小值
	max:100, // 最大值
	value:40,// 当前值
	step:10, // 滑动步长 默认为1
	style:SliderStyle.OutSet, // 滑块在滑动条外边 InSet:滑块在滑动条里边
	direction:Axis.Horizontal, // 水平方向 vertical:垂直方向
	reverse:false // 是否反向滑动
})
.width('90%')
.showTips(true) // 是否显示value%
.blockColor('#36d') // 滑动条颜色
.onChange(value => {
	// value就是当前的滑块值
})