-
- - 00
- - 01
- - 02
+
+ -
+
00
+
+ -
+
01
+
+ -
+
02
+
-
- - 00
- - 01
- - 02
+
+ -
+
00
+
+ -
+
01
+
+ -
+
02
+
diff --git a/src/picker/PickerColumn.js b/src/picker/PickerColumn.js
index d966f2c21..60aad747e 100644
--- a/src/picker/PickerColumn.js
+++ b/src/picker/PickerColumn.js
@@ -270,7 +270,6 @@ export default createComponent({
tabindex: disabled ? -1 : 0,
},
class: [
- 'van-ellipsis',
bem('item', {
disabled,
selected: index === this.currentIndex,
@@ -283,13 +282,18 @@ export default createComponent({
},
};
- if (this.allowHtml) {
- data.domProps = {
- innerHTML: text,
- };
- }
+ const childData = {
+ class: 'van-ellipsis',
+ domProps: {
+ [this.allowHtml ? 'innerHTML' : 'innerText']: text,
+ },
+ };
- return
{this.allowHtml ? '' : text};
+ return (
+
+
+
+ );
});
},
},
@@ -299,7 +303,6 @@ export default createComponent({
transform: `translate3d(0, ${this.offset + this.baseOffset}px, 0)`,
transitionDuration: `${this.duration}ms`,
transitionProperty: this.duration ? 'all' : 'none',
- lineHeight: `${this.itemHeight}px`,
};
return (
diff --git a/src/picker/index.less b/src/picker/index.less
index 80b29bbc7..cc24b8039 100644
--- a/src/picker/index.less
+++ b/src/picker/index.less
@@ -87,16 +87,17 @@
flex: 1;
overflow: hidden;
font-size: @picker-option-font-size;
- text-align: center;
&__wrapper {
transition-timing-function: cubic-bezier(0.23, 1, 0.68, 1);
}
&__item {
- padding: 0 5px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0 @padding-base;
color: @picker-option-text-color;
- -webkit-text-size-adjust: 100%; /* avoid iOS text size adjust */
&--disabled {
opacity: @picker-option-disabled-opacity;
diff --git a/src/picker/test/__snapshots__/demo.spec.js.snap b/src/picker/test/__snapshots__/demo.spec.js.snap
index b5acf83fe..b161c5ea4 100644
--- a/src/picker/test/__snapshots__/demo.spec.js.snap
+++ b/src/picker/test/__snapshots__/demo.spec.js.snap
@@ -7,12 +7,22 @@ exports[`renders demo correctly 1`] = `
-
- - 杭州
- - 宁波
- - 温州
- - 嘉兴
- - 湖州
+
+ -
+
杭州
+
+ -
+
宁波
+
+ -
+
温州
+
+ -
+
嘉兴
+
+ -
+
湖州
+
@@ -26,12 +36,22 @@ exports[`renders demo correctly 1`] = `
-
- - 杭州
- - 宁波
- - 温州
- - 嘉兴
- - 湖州
+
+ -
+
杭州
+
+ -
+
宁波
+
+ -
+
温州
+
+ -
+
嘉兴
+
+ -
+
湖州
+
@@ -48,12 +68,22 @@ exports[`renders demo correctly 1`] = `
-
- - 杭州
- - 宁波
- - 温州
- - 嘉兴
- - 湖州
+
+ -
+
杭州
+
+ -
+
宁波
+
+ -
+
温州
+
+ -
+
嘉兴
+
+ -
+
湖州
+
@@ -70,19 +100,35 @@ exports[`renders demo correctly 1`] = `
-
- - 周一
- - 周二
- - 周三
- - 周四
- - 周五
+
+ -
+
周一
+
+ -
+
周二
+
+ -
+
周三
+
+ -
+
周四
+
+ -
+
周五
+
-
- - 上午
- - 下午
- - 晚上
+
+ -
+
上午
+
+ -
+
下午
+
+ -
+
晚上
+
@@ -99,21 +145,33 @@ exports[`renders demo correctly 1`] = `
@@ -127,10 +185,16 @@ exports[`renders demo correctly 1`] = `
-
- - 杭州
- - 宁波
- - 温州
+
+ -
+
杭州
+
+ -
+
宁波
+
+ -
+
温州
+
@@ -144,18 +208,32 @@ exports[`renders demo correctly 1`] = `
-
- - 杭州
- - 宁波
- - 温州
- - 嘉兴
- - 湖州
+
+ -
+
杭州
+
+ -
+
宁波
+
+ -
+
温州
+
+ -
+
嘉兴
+
+ -
+
湖州
+
@@ -169,18 +247,32 @@ exports[`renders demo correctly 1`] = `
-
- - 杭州
- - 宁波
- - 温州
- - 嘉兴
- - 湖州
+
+ -
+
杭州
+
+ -
+
宁波
+
+ -
+
温州
+
+ -
+
嘉兴
+
+ -
+
湖州
+
diff --git a/src/picker/test/__snapshots__/index.spec.js.snap b/src/picker/test/__snapshots__/index.spec.js.snap
index 81730e570..42abda380 100644
--- a/src/picker/test/__snapshots__/index.spec.js.snap
+++ b/src/picker/test/__snapshots__/index.spec.js.snap
@@ -2,28 +2,56 @@
exports[`column watch default index 1`] = `
-
- - 1
- - 1990
- - 1991
- - 1992
- - 1993
- - 1994
- - 1995
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
`;
exports[`column watch default index 2`] = `
-
- - 1
- - 1990
- - 1991
- - 1992
- - 1993
- - 1994
- - 1995
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
`;
@@ -33,7 +61,7 @@ exports[`columns-top、columns-bottom prop 1`] = `
Custom Columns Top
@@ -47,8 +75,10 @@ exports[`not allow html 1`] = `
@@ -64,7 +94,7 @@ exports[`render title slot 1`] = `
@@ -79,7 +109,7 @@ exports[`toolbar-position prop 1`] = `