-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comp:select): add
loading
prop for select component (#1439)
* feat(comp:select): add loading prop * fix(comp:select): spin type in api doc
- Loading branch information
Showing
6 changed files
with
60 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: | ||
zh: 加载中 | ||
en: Loading | ||
order: 51 | ||
--- | ||
## zh | ||
|
||
数据还未加载完成时,展示一个加载中的状态。 | ||
|
||
## en | ||
|
||
When the data has not been loaded yet, display a loading status。 |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<template> | ||
<IxSpace vertical> | ||
<IxSelect v-model:value="value" :dataSource="dataSource" :spin="loading"></IxSelect> | ||
<IxButton @click="onLoad">Load Data</IxButton> | ||
</IxSpace> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { SelectData } from '@idux/components/select' | ||
const dataSource = ref<SelectData[]>([{ label: 'Tom', value: 'tom' }]) | ||
const value = ref('tom') | ||
const loading = ref(false) | ||
const onLoad = () => { | ||
dataSource.value = [{ label: 'Tom', value: 'tom' }] | ||
value.value = 'tom' | ||
if (loading.value) { | ||
return | ||
} | ||
loading.value = true | ||
setTimeout(() => { | ||
loading.value = false | ||
dataSource.value = [ | ||
{ label: 'Tom', value: 'tom' }, | ||
{ label: 'Jack', value: 'jack' }, | ||
{ label: 'Lucy', value: 'lucy' }, | ||
] | ||
}, 3000) | ||
} | ||
</script> |
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
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