diff --git a/src/area/test/__snapshots__/index.spec.js.snap b/src/area/test/__snapshots__/index.spec.js.snap
index 15e07ccc9..7d05b31f5 100644
--- a/src/area/test/__snapshots__/index.spec.js.snap
+++ b/src/area/test/__snapshots__/index.spec.js.snap
@@ -10,19 +10,19 @@ exports[`change option 1`] = `
@@ -44,18 +44,18 @@ exports[`change option 2`] = `
@@ -77,19 +77,19 @@ exports[`change option 3`] = `
@@ -109,13 +109,13 @@ exports[`columns-num prop 1`] = `
@@ -137,18 +137,18 @@ exports[`reset method 1`] = `
@@ -168,19 +168,19 @@ exports[`reset method 2`] = `
@@ -201,19 +201,19 @@ exports[`watch areaList & code 1`] = `
@@ -234,19 +234,19 @@ exports[`watch areaList & code 2`] = `
@@ -267,19 +267,19 @@ exports[`watch areaList & code 3`] = `
diff --git a/src/datetime-picker/test/__snapshots__/demo.spec.js.snap b/src/datetime-picker/test/__snapshots__/demo.spec.js.snap
index 9dfa89788..f6511f935 100644
--- a/src/datetime-picker/test/__snapshots__/demo.spec.js.snap
+++ b/src/datetime-picker/test/__snapshots__/demo.spec.js.snap
@@ -12,13 +12,13 @@ exports[`renders demo correctly 1`] = `
- - 01
+ - 01
- 02
- 03
- 04
@@ -34,7 +34,7 @@ exports[`renders demo correctly 1`] = `
- - 01
+ - 01
- 02
- 03
- 04
@@ -69,7 +69,7 @@ exports[`renders demo correctly 1`] = `
- - 00
+ - 00
- 01
- 02
- 03
@@ -97,7 +97,7 @@ exports[`renders demo correctly 1`] = `
- - 00
+ - 00
- 01
- 02
- 03
@@ -175,7 +175,7 @@ exports[`renders demo correctly 1`] = `
- - 2018
+ - 2018
- 2019
- 2020
- 2021
@@ -191,7 +191,7 @@ exports[`renders demo correctly 1`] = `
- - 01
+ - 01
- 02
- 03
- 04
@@ -207,7 +207,7 @@ exports[`renders demo correctly 1`] = `
- - 01
+ - 01
- 02
- 03
- 04
@@ -256,7 +256,7 @@ exports[`renders demo correctly 1`] = `
- - 2018年
+ - 2018年
- 2019年
- 2020年
- 2021年
@@ -272,7 +272,7 @@ exports[`renders demo correctly 1`] = `
- - 01月
+ - 01月
- 02月
- 03月
- 04月
@@ -304,7 +304,7 @@ exports[`renders demo correctly 1`] = `
- 10
- 11
- - 12
+ - 12
- 13
- 14
- 15
@@ -317,7 +317,7 @@ exports[`renders demo correctly 1`] = `
- - 00
+ - 00
- 01
- 02
- 03
@@ -407,7 +407,7 @@ exports[`renders demo correctly 1`] = `
- 09
- 10
- 11
- - 12
+ - 12
- 13
- 14
- 15
@@ -423,7 +423,7 @@ exports[`renders demo correctly 1`] = `
- - 00
+ - 00
- 05
- 10
- 15
diff --git a/src/picker/PickerColumn.js b/src/picker/PickerColumn.js
index ca4236381..0a4529a77 100644
--- a/src/picker/PickerColumn.js
+++ b/src/picker/PickerColumn.js
@@ -118,8 +118,7 @@ export default createComponent({
const distance = this.offset - this.momentumOffset;
const duration = Date.now() - this.touchStartTime;
const allowMomentum =
- duration < MOMENTUM_LIMIT_TIME &&
- Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
+ duration < MOMENTUM_LIMIT_TIME && Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
if (allowMomentum) {
this.momentum(distance, duration);
@@ -195,17 +194,13 @@ export default createComponent({
},
getIndexByOffset(offset) {
- return range(
- Math.round(-offset / this.itemHeight),
- 0,
- this.count - 1
- );
+ return range(Math.round(-offset / this.itemHeight), 0, this.count - 1);
},
momentum(distance, duration) {
const speed = Math.abs(distance / duration);
- distance = this.offset + speed / 0.002 * (distance < 0 ? -1 : 1);
+ distance = this.offset + (speed / 0.002) * (distance < 0 ? -1 : 1);
const index = this.getIndexByOffset(distance);
@@ -259,7 +254,10 @@ export default createComponent({
style={optionStyle}
class={[
'van-ellipsis',
- bem('item', { disabled: isOptionDisabled(option) })
+ bem('item', {
+ disabled: isOptionDisabled(option),
+ selected: index === this.currentIndex
+ })
]}
domPropsInnerHTML={this.getOptionText(option)}
onClick={() => {
diff --git a/src/picker/test/__snapshots__/demo.spec.js.snap b/src/picker/test/__snapshots__/demo.spec.js.snap
index 8c298ad26..78184b9e2 100644
--- a/src/picker/test/__snapshots__/demo.spec.js.snap
+++ b/src/picker/test/__snapshots__/demo.spec.js.snap
@@ -8,7 +8,7 @@ exports[`renders demo correctly 1`] = `
- - 杭州
+ - 杭州
- 宁波
- 温州
- 嘉兴
@@ -29,7 +29,7 @@ exports[`renders demo correctly 1`] = `
@@ -51,7 +51,7 @@ exports[`renders demo correctly 1`] = `
- - 杭州
+ - 杭州
- 宁波
- 温州
- 嘉兴
@@ -80,7 +80,7 @@ exports[`renders demo correctly 1`] = `
@@ -96,7 +96,7 @@ exports[`renders demo correctly 1`] = `
@@ -104,7 +104,7 @@ exports[`renders demo correctly 1`] = `
@@ -121,7 +121,7 @@ exports[`renders demo correctly 1`] = `
@@ -129,7 +129,7 @@ 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 295864757..c88983ee1 100644
--- a/src/picker/test/__snapshots__/index.spec.js.snap
+++ b/src/picker/test/__snapshots__/index.spec.js.snap
@@ -3,7 +3,7 @@
exports[`column watch default index 1`] = `
- - 1
+ - 1
- 1990
- 1991
- 1992
@@ -19,7 +19,7 @@ exports[`column watch default index 2`] = `
- 1
- 1990
- - 1991
+ - 1991
- 1992
- 1993
- 1994