mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
[new feature] Picker: add loading prop (#619)
This commit is contained in:
@@ -37,14 +37,11 @@ export default create({
|
||||
valueKey: String,
|
||||
className: String,
|
||||
itemHeight: Number,
|
||||
visibleItemCount: Number,
|
||||
options: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
default: 5
|
||||
},
|
||||
defaultIndex: {
|
||||
type: Number,
|
||||
default: 0
|
||||
|
@@ -7,7 +7,10 @@
|
||||
<div class="van-picker__confirm" @click="emit('confirm')">{{ confirmButtonText || $t('confirm') }}</div>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="van-picker__columns" @touchmove.prevent>
|
||||
<div v-if="loading" class="van-picker__loading">
|
||||
<loading type="circular" />
|
||||
</div>
|
||||
<div class="van-picker__columns" :style="columnsStyle" @touchmove.prevent>
|
||||
<picker-column
|
||||
v-for="(item, index) in currentColumns"
|
||||
:key="index"
|
||||
@@ -38,10 +41,14 @@ export default create({
|
||||
|
||||
props: {
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
showToolbar: Boolean,
|
||||
confirmButtonText: String,
|
||||
cancelButtonText: String,
|
||||
visibleItemCount: Number,
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
default: 5
|
||||
},
|
||||
valueKey: {
|
||||
type: String,
|
||||
default: 'text'
|
||||
@@ -78,6 +85,12 @@ export default create({
|
||||
return {
|
||||
height: this.itemHeight + 'px'
|
||||
};
|
||||
},
|
||||
|
||||
columnsStyle() {
|
||||
return {
|
||||
height: this.itemHeight * this.visibleItemCount + 'px'
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user