Skip to content

Commit

Permalink
revert: 1.0.0-alpha.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyh2001 committed May 13, 2024
1 parent 34bcd07 commit 065477c
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 55 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 组件默认值不显示问题
Expand Down
8 changes: 8 additions & 0 deletions docs/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 组件默认值不显示问题
Expand Down
35 changes: 13 additions & 22 deletions packages/fighting-design/option/src/option.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down Expand Up @@ -115,7 +97,7 @@
*
* 返回优先级:插槽 > label > value
*/
const currentLabel: SelectModelValue = getEffectiveValue(
const currentLabel: SelectModelValue = correctValue(
slotLabel.value,
prop.label,
prop.value
Expand All @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 5 additions & 2 deletions packages/fighting-design/select/src/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
// 避免文本框内容不同步的问题
await nextTick()
/**
* 如果最新的 value 和绑定的 value 不一致时
*
Expand Down
48 changes: 18 additions & 30 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 065477c

Please sign in to comment.