-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: formkit select component not emitting event or updating selectio…
…n on value change (#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 #6594 #### Does this PR introduce a user-facing change? ```release-note 解决 Formkit Select 组件在值变更时不会发出事件及修改选项值的问题。 ```
- Loading branch information
Showing
3 changed files
with
53 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export const isFalse = (value: string | boolean | undefined | null) => { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export const isFalse = (value: any, onlyBoolean = false) => { | ||
if (onlyBoolean) { | ||
return [false, "false"].includes(value); | ||
} | ||
return [undefined, null, "false", false].includes(value); | ||
}; |