CustomSelectUI.ets
566 Bytes
import { CompDTO } from 'wdBean'
@Component
export struct CustomSelectUI {
@ObjectLink @Watch('selectChage') data:CompDTO
selectCallback: (item:CompDTO) => void = () => {
}
build() {
Button(){
Image(this.data.isSelect?$r("app.media.MyCollection_selected_icon"):$r("app.media.MyCollection_unselected_icon"))
}.onClick(()=>{
this.data.isSelect = this.data.isSelect?false:true
})
.backgroundColor(Color.White)
.type(ButtonType.Normal)
.width(20)
.height(20)
}
selectChage(){
this.selectCallback(this.data)
}
}