Skip to content

Commit 065477c

Browse files
committed
revert: 1.0.0-alpha.5
1 parent 34bcd07 commit 065477c

File tree

7 files changed

+61
-55
lines changed

7 files changed

+61
-55
lines changed

CHANGELOG.en-US.md

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
55
English | [Chinese](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.md)
66

7+
## 1.0.0-alpha.5 (2024-05-13)
8+
9+
- Fix the issue of default values not displaying for `f-select` components
10+
11+
## 1.0.0-alpha.4 (2024-05-14)
12+
13+
- Fix the issue of default values not displaying for `f-select` components
14+
715
## 1.0.0-alpha.3 (2024-05-11)
816

917
- Fix the issue of default values not displaying for `f-select` components

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
中文 | [英文](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.en-US.md)
44

5+
## 1.0.0-alpha.5 (2024-05-13)
6+
7+
- 修复 `f-select` 组件默认值不显示问题
8+
9+
## 1.0.0-alpha.4 (2024-05-14)
10+
11+
- 修复 `f-select` 组件默认值不显示问题
12+
513
## 1.0.0-alpha.3 (2024-05-11)
614

715
- 修复 `f-select` 组件默认值不显示问题

docs/docs/changelog.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
中文 | [英文](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.en-US.md)
44

5+
## 1.0.0-alpha.5 (2024-05-13)
6+
7+
- 修复 `f-select` 组件默认值不显示问题
8+
9+
## 1.0.0-alpha.4 (2024-05-14)
10+
11+
- 修复 `f-select` 组件默认值不显示问题
12+
513
## 1.0.0-alpha.3 (2024-05-11)
614

715
- 修复 `f-select` 组件默认值不显示问题

packages/fighting-design/option/src/option.vue

+13-22
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,14 @@
5555
return true
5656
})
5757
58-
/** 标签选中状态 */
59-
const labelActive = computed((): boolean => {
60-
/** 获取到 value 的值 */
61-
const val: string | number = prop.value || prop.label || slotLabel.value
62-
63-
if (parentInject) {
64-
return val === parentInject.modelValue
65-
}
66-
67-
return false
68-
})
69-
7058
/**
7159
* 获取有效的值
7260
*
73-
* 如果三个值都为假,返回最后一个
74-
*
75-
* 空数组或者空对象判断为假
76-
*
77-
* 0 判断为真
78-
*
79-
* null、undefined、NaN 判断为假
61+
* 如果三个值都为假,返回最后一个、空数组或者空对象判断为假、0 判断为真、null、undefined、NaN 判断为假
8062
*
8163
* @param {*} values 参数集合
8264
*/
83-
const getEffectiveValue = (...values: any[]): string => {
65+
const correctValue = (...values: any[]): string | number => {
8466
// 没有数据返回空字符串
8567
if (!values || !values.length) {
8668
return ''
@@ -115,7 +97,7 @@
11597
*
11698
* 返回优先级:插槽 > label > value
11799
*/
118-
const currentLabel: SelectModelValue = getEffectiveValue(
100+
const currentLabel: SelectModelValue = correctValue(
119101
slotLabel.value,
120102
prop.label,
121103
prop.value
@@ -126,12 +108,21 @@
126108
*
127109
* 返回优先级:value > label > 插槽
128110
*/
129-
const currentValue: SelectModelValue = getEffectiveValue(
111+
const currentValue: SelectModelValue = correctValue(
130112
prop.value,
131113
prop.label,
132114
slotLabel.value
133115
)
134116
117+
/** 标签选中状态 */
118+
const labelActive = computed((): boolean => {
119+
if (parentInject) {
120+
return currentValue === parentInject.modelValue
121+
}
122+
123+
return false
124+
})
125+
135126
/**
136127
* 点击传入指定的 value
137128
*

packages/fighting-design/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fighting-design",
3-
"version": "1.0.0-alpha.3",
3+
"version": "1.0.0-alpha.5",
44
"description": "Fighting design can quickly build interactive interfaces in vue3 applications, which looks good.",
55
"keywords": [
66
"fighting",

packages/fighting-design/select/src/select.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@
4040
* @param { string | number } currentLabel 新增 label 值
4141
* @param { Object } evt 事件对象
4242
*/
43-
const setValue = (
43+
const setValue = async (
4444
currentValue: SelectModelValue,
4545
currentLabel: SelectModelValue,
4646
evt?: MouseEvent
47-
): void => {
47+
): Promise<void> => {
48+
// 避免文本框内容不同步的问题
49+
await nextTick()
50+
4851
/**
4952
* 如果最新的 value 和绑定的 value 不一致时
5053
*

pnpm-lock.yaml

+18-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)