HarmonyOS 在组件的appear中去设置AttributeModifier或者GestureModifier不会触发UI刷新,貌似跟reuse有关系,加上这个标记后就会失效,帮忙确认下失效原因?

代码片段:

@Entry
@Component
@Reusable
struct Index {
  // modifier: MyButtonModifier = new MyButtonModifier()
  state: State = new State()
  build() {
    Row() {
      Column() {
        Button('切换')
          .onClick(() => {
            if (this.state.modifier.supportDoubleTap.supportDoubleTap) else
            {
              this.state.modifier.supportDoubleTap = {
                supportDoubleTap: true
              }
              this.state.mod.isDark = false
            }
          })
        Column() {
          Text('111')
            .onAppear(() => {
              this.state.mod.isDark = true
              this.state.modifier.supportDoubleTap = {
                supportDoubleTap: false
              }
            })
        }
        .gestureModifier(this.state.modifier)
        .width(500)
        .height(500)
        ...
阅读 506
1 个回答