Skip to content
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

Merged
merged 29 commits into from Apr 27, 2018
Merged

Conversation

jerryni
Copy link
Contributor

@jerryni jerryni commented Apr 25, 2018

swipe组件支持垂直滚动,增加vertical属性 #734

  • 支持垂直滚动
  • indicators样式随之变化
  • 修复touchmove错误代码
  • swipe-item添加垂直方向属性

@codecov-io
Copy link

codecov-io commented Apr 25, 2018

Codecov Report

Merging #938 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 390473c...0aef970. Read the comment docs.

@@ -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;
Copy link
Member

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;

@@ -17,9 +17,12 @@
</div>
<div
v-if="showIndicators && count > 1"
:class="b('indicators')"
:class="b(indicatorsStyle)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:class="b('indicators', { veritical })"

@@ -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 | - |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false 包上引号

@@ -18,6 +18,14 @@ export default create({

computed: {
style() {
if (this.$parent.vertical) {
Copy link
Member

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)`
};

<i
v-for="index in count"
:key="index"
:class="b('indicator', { active: index - 1 === activeIndicator })" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/> 换行

@@ -206,6 +235,10 @@ export default create({

range(num, arr) {
return Math.min(Math.max(num, arr[0]), arr[1]);
},

size() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为计算属性

height: $van-swipe-indicator;
transform: translate3d(-50%, 0, 0);
}

&__indicators-vertical {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indicators--vertical

@chenjiahan chenjiahan merged commit 21372be into youzan:dev Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants