$$运算符为系统内置组件提供TS变量的引用,使得TS变量和系统内置组件的内部状态保持同步。
内部状态具体指什么取决于组件。例如,bindPropup属性方法的show参数。
// xxx.ets
@Entry
@Component
struct bindPopupPage{
@State customPopup: boolean = false;
build(){
Column(){
Button('Popup')
.margin(20)
.onClick(()=>{
this.customPopup = !this.customPopup
})
.bindPopup($$this.customPopup,{
message: 'showPopup'
})
}
}
}