diff --git a/packages/picker/README.md b/packages/picker/README.md index 5040c668..8688d5b7 100644 --- a/packages/picker/README.md +++ b/packages/picker/README.md @@ -149,6 +149,7 @@ Page({ |------|------|------|------|------| | columns | 对象数组,配置每一列显示的数据 | *Array* | `[]` | - | | show-toolbar | 是否显示顶部栏 | *boolean* | `false` | - | +| toolbar-position | 顶部栏位置,可选值为`bottom` | *string* | `top` | - | | title | 顶部栏标题 | *string* | `''` | - | | loading | 是否显示加载状态 | *boolean* | `false` | - | | value-key | 选项对象中,文字对应的 key | *string* | `text` | - | diff --git a/packages/picker/index.ts b/packages/picker/index.ts index 2a1b7395..33a04c74 100644 --- a/packages/picker/index.ts +++ b/packages/picker/index.ts @@ -16,6 +16,10 @@ VantComponent({ type: String, value: 'text' }, + toolbarPosition: { + type: String, + value: 'top' + }, defaultIndex: { type: Number, value: 0 diff --git a/packages/picker/index.wxml b/packages/picker/index.wxml index 2a9cead2..efd97850 100644 --- a/packages/picker/index.wxml +++ b/packages/picker/index.wxml @@ -1,4 +1,4 @@ -<view class="van-picker custom-class"> +<template name="toolbar"> <view wx:if="{{ showToolbar }}" class="van-picker__toolbar van-hairline--top-bottom toolbar-class" @@ -23,6 +23,10 @@ {{ confirmButtonText }} </view> </view> +</template> + +<view class="van-picker custom-class"> + <template is="toolbar" wx:if="{{ toolbarPosition === 'top' }}" data="{{ showToolbar, cancelButtonText, title, confirmButtonText }}"></template> <view wx:if="{{ loading }}" class="van-picker__loading"> <loading color="#1989fa"/> </view> @@ -50,6 +54,7 @@ style="height: {{ itemHeight }}px" /> </view> + <template is="toolbar" wx:if="{{ toolbarPosition === 'bottom' }}" data="{{ showToolbar, cancelButtonText, title, confirmButtonText }}"></template> </view> <wxs module="isSimple">