Skip to content

Commit abef536

Browse files
feat: Picker 组件新增 showOkText、showCancelText (#1933)
* fix: 修复 ImagePreview 在Taro编译成H5后报错的问题 * fix: 地址关闭时, Close 事件触发两次问题解决 * feat: 组件DatePicker 添加双向绑定 * docs: 组件Picker文档修改 * feat: 组件Picker与DatePicker新增属性safe-area-inset-bottom * feat: imagepreview * fix: 组件imagepreview点击视频遮罩关闭(#1729) * fix: 解决 Picker 在微信小程序中无法使用问题 (#1774) * fix: 修改 Picker 组件 v-model 失效问题 * fix: 组件NoticeBar修改height之后,垂直轮播会卡顿 * fix: 删除Datepicker Demo演示多余内容 * fix: 组件Picker在JD小程序上适配 * fix: 组件Address京东小程序适配 * feat: 京东小程序适配 * fix: 删除空格 * feat: 删除console * fix: 京东小程序imagepreview适配 * fix: 修复 imagepreview 动态设置 initNo 显示不正确问题 * fix: 组件 InfiniteLoading 某些情况下会错误触发下拉刷新#1819 * fix: 删除pullrefresh * feat: 组件 imagepreview瘦身 * feat: 组件Picker 瘦身 * fix: address线上问题修改 * fix: 完善imagepreview * feat: 公共函数提取 * feat: 函数式改用 createComponent * fix: 文件回撤 * feat: 单元测试修改 * fix: 组件popover样式问题修改 * feat: 新增 clamp 函数 * fix: 组件Infiniteloading Review 内容修改 * fix: 组件Infiniteloading问题更新 * feat: getScrollTopRoot函数修改 * feat: 组件popover新增功能 * feat: 组件picker新增 showOkText/showCancelText
1 parent eaf379b commit abef536

File tree

8 files changed

+53
-10
lines changed

8 files changed

+53
-10
lines changed

src/packages/__VUE/picker/common.ts

+16
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ export const componentWeb = {
5353
swipeDuration: {
5454
type: [Number, String],
5555
default: 1000
56+
},
57+
showOkText: {
58+
type: Boolean,
59+
default: true
60+
},
61+
showCancelText: {
62+
type: Boolean,
63+
default: true
5664
}
5765
},
5866
emits: ['close', 'change', 'confirm', 'update:visible', 'update:modelValue'],
@@ -159,6 +167,14 @@ export const componentWeapp = {
159167
swipeDuration: {
160168
type: [Number, String],
161169
default: 1000
170+
},
171+
showOkText: {
172+
type: Boolean,
173+
default: true
174+
},
175+
showCancelText: {
176+
type: Boolean,
177+
default: true
162178
}
163179
},
164180
emits: ['close', 'change', 'confirm', 'update:visible', 'update:modelValue'],

src/packages/__VUE/picker/demo.vue

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
:title="translate('chooseCity')"
1717
@change="change"
1818
@confirm="(options) => confirm('index', options)"
19+
:showCancelText="false"
1920
></nut-picker>
2021

2122
<h2>{{ translate('defaultSelected') }}</h2>

src/packages/__VUE/picker/doc.en-US.md

+2
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ Slots are arranged at the bottom and top respectively for custom Settings
432432
| three-dimensional `v3.1.23` | Turn on 3D effects | Boolean | true |
433433
| swipe-duration`v3.2.2` | Duration of the momentum animation | Number、String | 1000 |
434434
| safe-area-inset-bottom `v3.2.4` | Whether to enable iPhone series full screen bottom safety zone adaptation, which is only valid when `position` is `bottom` | Boolean |`false` |
435+
| show-ok-text `v3.3.1` | Is show confirm button | Boolean |`true` |
436+
| show-cancel-text `v3.3.1` | Is show cancel button | Boolean |`true` |
435437

436438
### Data Structure of Columns
437439

src/packages/__VUE/picker/doc.md

+2
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ Picker 组件在底部和顶部分别设置了插槽,可进行自定义设置
429429
| three-dimensional`v3.1.23` | 是否开启3D效果 | Boolean | true |
430430
| swipe-duration`v3.2.2` | 惯性滚动时长 | Number、String | 1000 |
431431
| safe-area-inset-bottom `v3.2.4` | 是否开启 iphone 系列全面屏底部安全区适配,仅当 `position``bottom` 时有效 | Boolean |`false` |
432+
| show-ok-text `v3.3.1` | 是否展示确定按钮 | Boolean |`true` |
433+
| show-cancel-text `v3.3.1` | 是否展示取消按钮 | Boolean |`true` |
432434

433435
> 注:自 `v3.2.3` 起,在 @nutui/nutui-taro 中,取消 3D 展示效果,`three-dimensional` 废弃。
434436
### Columns 数据结构

src/packages/__VUE/picker/index.scss

+10-4
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@
3434
.nut-picker {
3535
// 标题
3636
&__bar {
37-
display: flex;
37+
position: relative;
3838
height: 56px;
39-
align-items: center;
40-
justify-content: space-between;
39+
display: block;
40+
text-align: center;
41+
line-height: 56px;
4142
}
4243

4344
&__left {
45+
position: absolute;
46+
left: 0;
47+
top: 0;
4448
cursor: pointer;
4549
padding: $picker-bar-button-padding;
4650
display: flex;
@@ -52,6 +56,9 @@
5256
font-size: $picker-bar-cancel-font-size;
5357
}
5458
&__right {
59+
position: absolute;
60+
right: 0;
61+
top: 0;
5562
cursor: pointer;
5663
padding: $picker-bar-button-padding;
5764
display: flex;
@@ -86,7 +93,6 @@
8693
}
8794

8895
&__title {
89-
flex: 1;
9096
@include oneline-ellipsis();
9197
text-align: center;
9298
color: $picker-bar-title-color;

src/packages/__VUE/picker/index.taro.vue

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
:destroyOnClose="destroyOnClose"
1313
>
1414
<view class="nut-picker__bar">
15-
<view class="nut-picker__cancel nut-picker__left nut-picker__button" @click="close">{{
15+
<view class="nut-picker__cancel nut-picker__left nut-picker__button" @click="close" v-if="showCancelText">{{
1616
cancelText || translate('cancel')
1717
}}</view>
1818
<view class="nut-picker__title"> {{ title }}</view>
19-
<view class="nut-picker__confirm nut-picker__right nut-picker__button" @click="confirmHandler()">{{
20-
okText || translate('confirm')
21-
}}</view>
19+
<view
20+
class="nut-picker__confirm nut-picker__right nut-picker__button"
21+
@click="confirmHandler()"
22+
v-if="showOkText"
23+
>{{ okText || translate('confirm') }}</view
24+
>
2225
</view>
2326
<slot name="top"></slot>
2427

src/packages/__VUE/picker/index.vue

+14-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
:destroyOnClose="destroyOnClose"
1414
>
1515
<view class="nut-picker__bar">
16-
<view class="nut-picker__left" @click="close">{{ cancelText || translate('cancel') }}</view>
16+
<view class="nut-picker__left" v-if="showCancelText" @click="close">{{
17+
cancelText || translate('cancel')
18+
}}</view>
1719
<view class="nut-picker__title"> {{ title }}</view>
18-
<view class="nut-picker__right" @click="confirmHandler()">{{ okText || translate('confirm') }}</view>
20+
<view class="nut-picker__right" v-if="showOkText" @click="confirmHandler()">{{
21+
okText || translate('confirm')
22+
}}</view>
1923
</view>
2024

2125
<slot name="top"></slot>
@@ -100,6 +104,14 @@ export default create({
100104
swipeDuration: {
101105
type: [Number, String],
102106
default: 1000
107+
},
108+
showOkText: {
109+
type: Boolean,
110+
default: true
111+
},
112+
showCancelText: {
113+
type: Boolean,
114+
default: true
103115
}
104116
},
105117
emits: ['close', 'change', 'confirm', 'update:visible', 'update:modelValue'],

src/sites/mobile-taro/vue/src/dentry/pages/picker/index.vue

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
:safeAreaInsetBottom="true"
1919
@change="change"
2020
@confirm="(options) => confirm('index', options)"
21+
:showCancelText="false"
2122
></nut-picker>
2223

2324
<h2>默认选中项</h2>

0 commit comments

Comments
 (0)