New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[new feature] #734 swipe组件支持垂直滚动 #938
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #938 +/- ##
=======================================
Coverage 94.12% 94.12%
=======================================
Files 93 93
Lines 1515 1515
Branches 303 303
=======================================
Hits 1426 1426
Misses 48 48
Partials 41 41 Continue to review full report at Codecov.
|
packages/swipe/index.vue
Outdated
@@ -115,9 +134,10 @@ export default create({ | |||
// reset offset when children changes | |||
clearTimeout(this.timer); | |||
this.width = this.$el.getBoundingClientRect().width; | |||
this.height = this.$el.getBoundingClientRect().height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const rect = this.$el.getBoundingClientRect();
this.width = rect.width;
this.height = rect.height;
packages/swipe/index.vue
Outdated
@@ -17,9 +17,12 @@ | |||
</div> | |||
<div | |||
v-if="showIndicators && count > 1" | |||
:class="b('indicators')" | |||
:class="b(indicatorsStyle)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:class="b('indicators', { veritical })"
docs/markdown/en-US/swipe.md
Outdated
@@ -75,6 +86,7 @@ export default { | |||
| loop | Whether to enable loop | `Boolean` | `true` | - | | |||
| show-indicators | Whether to show indocators | `Boolean` | `true` | - | | |||
| initial-swipe | Index of initial swipe, start from 0 | `Number` | `0` | - | | |||
| vertical | Vertical Scrolling | `Boolean` | false | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false
包上引号
packages/swipe-item/index.vue
Outdated
@@ -18,6 +18,14 @@ export default create({ | |||
|
|||
computed: { | |||
style() { | |||
if (this.$parent.vertical) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { vertical, width, height } = this.$parent;
return {
width: width + 'px',
height: vertical ? height + 'px' : '100%',
transform: `translate${vertical ? 'Y' : 'X'}(${this.offset}px)`
};
packages/swipe/index.vue
Outdated
<i | ||
v-for="index in count" | ||
:key="index" | ||
:class="b('indicator', { active: index - 1 === activeIndicator })" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/> 换行
packages/swipe/index.vue
Outdated
@@ -206,6 +235,10 @@ export default create({ | |||
|
|||
range(num, arr) { | |||
return Math.min(Math.max(num, arr[0]), arr[1]); | |||
}, | |||
|
|||
size() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改为计算属性
packages/vant-css/src/swipe.css
Outdated
height: $van-swipe-indicator; | ||
transform: translate3d(-50%, 0, 0); | ||
} | ||
|
||
&__indicators-vertical { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indicators--vertical
swipe组件支持垂直滚动,增加vertical属性 #734: