halo-dev / halo

强大易用的开源建站工具。
https://www.halo.run
GNU General Public License v3.0
33.24k stars 9.59k forks source link

在设置表单 repeater 中使用 select、if 和 group 的组合最终设置值错误 #5179

Closed wan92hen closed 7 months ago

wan92hen commented 8 months ago

系统信息

使用的哪种方式运行?

Docker

在线站点地址

No response

发生了什么?

使用类似下面的主题设置:

spec:
  forms:
    - group: index
      label: 首页配置
      formSchema:
        - $formkit: repeater
          name: blocks
          label: 内容块
          children:
            - $formkit: select
              name: name
              label: 名称
              options:
                - label: block1
                  value: block1          
                - label: block2
                  value: block2          
                - label: block3
                  value: block3
            - $formkit: group
              name: block1_config
              if: $value.name === "block1"
              label: 块1配置
              children:
                - $formkit: text
                  name: title1
                  label: 块1标题
                  value: "块1标题"
            - $formkit: group
              name: block2_config
              if: $value.name === "block2"
              label: 块2配置
              children:
                - $formkit: text
                  name: title2
                  label: 块2标题
                  value: "块2标题"              
                - $formkit: url
                  name: url2
                  label: 块2链接
                  value: "块2链接"

image 页面上进行类似上面的配置保存后,得到的结果 theme.config.index.blocks 有误,当前值为:

[{"name":"block1","block1_config":{"title1":"块1标题"}},{"name":"block2","block1_config":{"title1":"块1标题","url2":"块2链接"}}]

正确值应该是:

[{"name":"block1","block1_config":{"title1":"块1标题"}},{"name":"block2","block2_config":{"title2":"块2标题","url2":"块2链接"}}]

相关日志输出

No response

附加信息

No response

ruibaby commented 8 months ago

可以复现。

/kind bug /area console

ruibaby commented 8 months ago

在 FormKit 官方的 Playground 似乎也可以复现这个问题:https://formkit.link/c018b243acabd990b5c91bb797b0553f

晚些时候我将向 FormKit 提交一个 issue。

ruibaby commented 7 months ago

Please see github.com/formkit/formkit/issues/1144#issuecomment-1907361354

/remove-kind bug

ruibaby commented 7 months ago

/close

f2c-ci-robot[bot] commented 7 months ago

@ruibaby: Closing this issue.

In response to [this](https://github.com/halo-dev/halo/issues/5179#issuecomment-1907434026): >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.