Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formkit select组件值变化的问题 #6594

Closed
liuchangfitcloud opened this issue Sep 5, 2024 · 3 comments · Fixed by #6602
Closed

formkit select组件值变化的问题 #6594

liuchangfitcloud opened this issue Sep 5, 2024 · 3 comments · Fixed by #6602
Assignees
Labels
area/ui Issues or PRs related to the Halo UI kind/bug Categorizes issue or PR as related to a bug.

Comments

@liuchangfitcloud
Copy link
Contributor

系统信息

使用的哪种方式运行?

Fat Jar

发生了什么?

  • 值发生变化未触发change方法
  • 如果本身选中某个值如选中测试再通过js将值设置为undefined,还是显示原来的label测试

复现步骤

No response

相关日志输出

No response

附加信息

No response

@LIlGG
Copy link
Member

LIlGG commented Sep 5, 2024

值发生变化未触发change方法

这里由于目前是自定义组件,因此 @change 事件传递的参数需要发生变化。即原来的参数为 event,更改之后现在的参数为 Array<{ label: string; value: string }>

@ruibaby
Copy link
Member

ruibaby commented Sep 5, 2024

/kind bug
/area ui

@f2c-ci-robot f2c-ci-robot bot added kind/bug Categorizes issue or PR as related to a bug. area/ui Issues or PRs related to the Halo UI labels Sep 5, 2024
@LIlGG
Copy link
Member

LIlGG commented Sep 6, 2024

/assign

@f2c-ci-robot f2c-ci-robot bot closed this as completed in cf2837d Sep 6, 2024
LIlGG added a commit to LIlGG/halo that referenced this issue Sep 6, 2024
…n on value change (halo-dev#6602)

#### What type of PR is this?

/kind bug
/area ui
/milestone 2.20.x

#### What this PR does / why we need it:

重新修改 formkit select 初始化值的监听方式,用于当 value 发生变化时,使选项值可以发生变化。

另外在更新数据时,如果数据发生变化,则发出 `onChange` 事件。

> 需要注意的是,通过 v-modal 传入默认值,再将此值改为 `undefined` 时无法触发 `watch` 及 formkit 的 `input` 事件,原因暂时未知,将此值设置为 `""` 即可正常触发。

#### How to test it?

由于此 PR 改动了初始化的方式,因此需要全量测试所有使用 `Select` 组件的位置。包括多选与单选,本地源与远程源。确保功能符合预期。

#### Which issue(s) this PR fixes:

Fixes halo-dev#6594 

#### Does this PR introduce a user-facing change?
```release-note
解决 Formkit Select 组件在值变更时不会发出事件及修改选项值的问题。
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui Issues or PRs related to the Halo UI kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants