From 065477c331718b902e54a28228a1741be968aaef Mon Sep 17 00:00:00 2001 From: Tyh2001 <1469442737@qq.com> Date: Mon, 13 May 2024 16:59:11 +0800 Subject: [PATCH] revert: 1.0.0-alpha.5 --- CHANGELOG.en-US.md | 8 ++++ CHANGELOG.md | 8 ++++ docs/docs/changelog.md | 8 ++++ .../fighting-design/option/src/option.vue | 35 +++++--------- packages/fighting-design/package.json | 2 +- .../fighting-design/select/src/select.vue | 7 ++- pnpm-lock.yaml | 48 +++++++------------ 7 files changed, 61 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 4f437b1c10..68052af100 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -4,6 +4,14 @@ English | [Chinese](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.md) +## 1.0.0-alpha.5 (2024-05-13) + +- Fix the issue of default values not displaying for `f-select` components + +## 1.0.0-alpha.4 (2024-05-14) + +- Fix the issue of default values not displaying for `f-select` components + ## 1.0.0-alpha.3 (2024-05-11) - Fix the issue of default values not displaying for `f-select` components diff --git a/CHANGELOG.md b/CHANGELOG.md index fa65b4bbd2..ca7b47e15e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ 中文 | [英文](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.en-US.md) +## 1.0.0-alpha.5 (2024-05-13) + +- 修复 `f-select` 组件默认值不显示问题 + +## 1.0.0-alpha.4 (2024-05-14) + +- 修复 `f-select` 组件默认值不显示问题 + ## 1.0.0-alpha.3 (2024-05-11) - 修复 `f-select` 组件默认值不显示问题 diff --git a/docs/docs/changelog.md b/docs/docs/changelog.md index fa65b4bbd2..ca7b47e15e 100644 --- a/docs/docs/changelog.md +++ b/docs/docs/changelog.md @@ -2,6 +2,14 @@ 中文 | [英文](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.en-US.md) +## 1.0.0-alpha.5 (2024-05-13) + +- 修复 `f-select` 组件默认值不显示问题 + +## 1.0.0-alpha.4 (2024-05-14) + +- 修复 `f-select` 组件默认值不显示问题 + ## 1.0.0-alpha.3 (2024-05-11) - 修复 `f-select` 组件默认值不显示问题 diff --git a/packages/fighting-design/option/src/option.vue b/packages/fighting-design/option/src/option.vue index 4da54f9c91..4854e69957 100644 --- a/packages/fighting-design/option/src/option.vue +++ b/packages/fighting-design/option/src/option.vue @@ -55,32 +55,14 @@ return true }) - /** 标签选中状态 */ - const labelActive = computed((): boolean => { - /** 获取到 value 的值 */ - const val: string | number = prop.value || prop.label || slotLabel.value - - if (parentInject) { - return val === parentInject.modelValue - } - - return false - }) - /** * 获取有效的值 * - * 如果三个值都为假,返回最后一个 - * - * 空数组或者空对象判断为假 - * - * 0 判断为真 - * - * null、undefined、NaN 判断为假 + * 如果三个值都为假,返回最后一个、空数组或者空对象判断为假、0 判断为真、null、undefined、NaN 判断为假 * * @param {*} values 参数集合 */ - const getEffectiveValue = (...values: any[]): string => { + const correctValue = (...values: any[]): string | number => { // 没有数据返回空字符串 if (!values || !values.length) { return '' @@ -115,7 +97,7 @@ * * 返回优先级:插槽 > label > value */ - const currentLabel: SelectModelValue = getEffectiveValue( + const currentLabel: SelectModelValue = correctValue( slotLabel.value, prop.label, prop.value @@ -126,12 +108,21 @@ * * 返回优先级:value > label > 插槽 */ - const currentValue: SelectModelValue = getEffectiveValue( + const currentValue: SelectModelValue = correctValue( prop.value, prop.label, slotLabel.value ) + /** 标签选中状态 */ + const labelActive = computed((): boolean => { + if (parentInject) { + return currentValue === parentInject.modelValue + } + + return false + }) + /** * 点击传入指定的 value * diff --git a/packages/fighting-design/package.json b/packages/fighting-design/package.json index 7a3f5d7608..4a1ffaeaac 100644 --- a/packages/fighting-design/package.json +++ b/packages/fighting-design/package.json @@ -1,6 +1,6 @@ { "name": "fighting-design", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.5", "description": "Fighting design can quickly build interactive interfaces in vue3 applications, which looks good.", "keywords": [ "fighting", diff --git a/packages/fighting-design/select/src/select.vue b/packages/fighting-design/select/src/select.vue index 5ec4cdb294..0f948c478a 100644 --- a/packages/fighting-design/select/src/select.vue +++ b/packages/fighting-design/select/src/select.vue @@ -40,11 +40,14 @@ * @param { string | number } currentLabel 新增 label 值 * @param { Object } evt 事件对象 */ - const setValue = ( + const setValue = async ( currentValue: SelectModelValue, currentLabel: SelectModelValue, evt?: MouseEvent - ): void => { + ): Promise => { + // 避免文本框内容不同步的问题 + await nextTick() + /** * 如果最新的 value 和绑定的 value 不一致时 * diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7024165227..5e8379ad69 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -160,7 +160,7 @@ importers: dependencies: vue-router: specifier: ^4.1.6 - version: 4.1.6(vue@3.4.27) + version: 4.3.2(vue@3.4.27) packages: @@ -458,13 +458,13 @@ packages: '@types/node': 17.0.42 chalk: 4.1.2 cosmiconfig: 8.1.3 - cosmiconfig-typescript-loader: 4.3.0(@types/node@17.0.42)(cosmiconfig@8.1.3)(ts-node@10.9.1)(typescript@4.7.4) + cosmiconfig-typescript-loader: 4.3.0(@types/node@17.0.42)(cosmiconfig@8.1.3)(ts-node@10.9.1)(typescript@4.8.4) lodash.isplainobject: 4.0.6 lodash.merge: 4.6.2 lodash.uniq: 4.5.0 resolve-from: 5.0.0 ts-node: 10.9.1(@types/node@17.0.42)(typescript@4.7.4) - typescript: 4.7.4 + typescript: 4.8.4 transitivePeerDependencies: - '@swc/core' - '@swc/wasm' @@ -2091,23 +2091,14 @@ packages: '@volar/language-core': 1.7.6 dev: true - /@vue/compiler-core@3.3.4: - resolution: {integrity: sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==} - dependencies: - '@babel/parser': 7.21.8 - '@vue/shared': 3.3.4 - estree-walker: 2.0.2 - source-map-js: 1.0.2 - dev: true - /@vue/compiler-core@3.4.21: resolution: {integrity: sha512-MjXawxZf2SbZszLPYxaFCjxfibYrzr3eYbKxwpLR9EQN+oaziSu3qKVbwBERj1IFIB8OLUewxB5m/BFzi613og==} dependencies: - '@babel/parser': 7.24.0 + '@babel/parser': 7.24.5 '@vue/shared': 3.4.21 entities: 4.5.0 estree-walker: 2.0.2 - source-map-js: 1.0.2 + source-map-js: 1.2.0 dev: false /@vue/compiler-core@3.4.27: @@ -2119,13 +2110,6 @@ packages: estree-walker: 2.0.2 source-map-js: 1.2.0 - /@vue/compiler-dom@3.3.4: - resolution: {integrity: sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==} - dependencies: - '@vue/compiler-core': 3.3.4 - '@vue/shared': 3.3.4 - dev: true - /@vue/compiler-dom@3.4.21: resolution: {integrity: sha512-IZC6FKowtT1sl0CR5DpXSiEB5ayw75oT2bma1BEhV7RRR1+cfwLrxc2Z8Zq/RGFzJ8w5r9QtCOvTjQgdn0IKmA==} dependencies: @@ -2150,7 +2134,7 @@ packages: estree-walker: 2.0.2 magic-string: 0.30.7 postcss: 8.4.35 - source-map-js: 1.0.2 + source-map-js: 1.2.0 dev: false /@vue/compiler-sfc@3.4.27: @@ -2183,6 +2167,10 @@ packages: resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==} dev: false + /@vue/devtools-api@6.6.1: + resolution: {integrity: sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA==} + dev: false + /@vue/language-core@1.8.0(typescript@4.7.4): resolution: {integrity: sha512-rOAtqIRyyZ6OQreAkFDbbDt7L5BwvzrdbWaBAoEZjr4ImPBV9cRDBHxlMBU0SBOAZxIUQdjOvQ0uAl9uZDer0w==} peerDependencies: @@ -2193,9 +2181,9 @@ packages: dependencies: '@volar/language-core': 1.7.6 '@volar/source-map': 1.7.6 - '@vue/compiler-dom': 3.3.4 + '@vue/compiler-dom': 3.4.27 '@vue/reactivity': 3.3.4 - '@vue/shared': 3.3.4 + '@vue/shared': 3.4.27 minimatch: 9.0.1 muggle-string: 0.3.1 typescript: 4.7.4 @@ -2982,7 +2970,7 @@ packages: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} dev: true - /cosmiconfig-typescript-loader@4.3.0(@types/node@17.0.42)(cosmiconfig@8.1.3)(ts-node@10.9.1)(typescript@4.7.4): + /cosmiconfig-typescript-loader@4.3.0(@types/node@17.0.42)(cosmiconfig@8.1.3)(ts-node@10.9.1)(typescript@4.8.4): resolution: {integrity: sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==} engines: {node: '>=12', npm: '>=6'} requiresBuild: true @@ -2995,7 +2983,7 @@ packages: '@types/node': 17.0.42 cosmiconfig: 8.1.3 ts-node: 10.9.1(@types/node@17.0.42)(typescript@4.7.4) - typescript: 4.7.4 + typescript: 4.8.4 dev: true /cosmiconfig@8.1.3: @@ -5428,7 +5416,7 @@ packages: dependencies: nanoid: 3.3.7 picocolors: 1.0.0 - source-map-js: 1.0.2 + source-map-js: 1.2.0 dev: false /postcss@8.4.38: @@ -6636,12 +6624,12 @@ packages: - supports-color dev: false - /vue-router@4.1.6(vue@3.4.27): - resolution: {integrity: sha512-DYWYwsG6xNPmLq/FmZn8Ip+qrhFEzA14EI12MsMgVxvHFDYvlr4NXpVF5hrRH1wVcDP8fGi5F4rxuJSl8/r+EQ==} + /vue-router@4.3.2(vue@3.4.27): + resolution: {integrity: sha512-hKQJ1vDAZ5LVkKEnHhmm1f9pMiWIBNGF5AwU67PdH7TyXCj/a4hTccuUuYCAMgJK6rO/NVYtQIEN3yL8CECa7Q==} peerDependencies: vue: ^3.2.0 dependencies: - '@vue/devtools-api': 6.5.0 + '@vue/devtools-api': 6.6.1 vue: 3.4.27(typescript@4.7.4) dev: false