diff --git a/src/picker/index.js b/src/picker/index.js index 43e6b7e86..a94a643e1 100644 --- a/src/picker/index.js +++ b/src/picker/index.js @@ -1,5 +1,5 @@ import { ref, watch, computed } from 'vue'; -import { pickerProps, PICKER_KEY, DEFAULT_ITEM_HEIGHT } from './shared'; +import { pickerProps, PICKER_KEY } from './shared'; // Utils import { unitToPx, preventDefault, createNamespace } from '../utils'; @@ -45,9 +45,7 @@ export default createComponent({ linkChildren(); - const itemHeight = computed(() => - props.itemHeight ? unitToPx(props.itemHeight) : DEFAULT_ITEM_HEIGHT - ); + const itemHeight = computed(() => unitToPx(props.itemHeight)); const dataType = computed(() => { const { columns } = props; diff --git a/src/picker/shared.ts b/src/picker/shared.ts index b9ac9f9f3..f39093563 100644 --- a/src/picker/shared.ts +++ b/src/picker/shared.ts @@ -10,16 +10,17 @@ export type SharedPickerProps = { export const PICKER_KEY = 'vanPicker'; -export const DEFAULT_ITEM_HEIGHT = 44; - export const pickerProps = { title: String, loading: Boolean, readonly: Boolean, allowHtml: Boolean, - itemHeight: [Number, String], cancelButtonText: String, confirmButtonText: String, + itemHeight: { + type: [Number, String], + default: 44, + }, showToolbar: { type: Boolean, default: true,