Merge branch 'master' of gitlab.qima-inc.com:fe/zanui-vue
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'zan-swipe-item'
|
||||
name: 'zan-swipe-item',
|
||||
|
||||
beforeCreate() {
|
||||
this.$parent.swipes.push(this);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
<template>
|
||||
<div class="zan-swipe">
|
||||
<slot></slot>
|
||||
<div class="zan-swipe__items">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div class="zan-swipe__indicators" v-if="showIndicators">
|
||||
<span class="zan-swipe__indicator" v-for="i in swipes.length" :class="{
|
||||
'zan-swipe__indicator--active': currIndex === i -1
|
||||
}">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -13,16 +21,20 @@ export default {
|
||||
name: 'zan-swipe',
|
||||
|
||||
props: {
|
||||
autoPlay: {
|
||||
autoPlay: Boolean,
|
||||
showIndicators: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
onPageChangeEnd: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
default: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
currIndex: 0,
|
||||
swipes: []
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.input = new Input(this.$el, {
|
||||
listenMoving: true
|
||||
@@ -53,6 +65,13 @@ export default {
|
||||
|
||||
updated() {
|
||||
this.scroll.update();
|
||||
},
|
||||
|
||||
methods: {
|
||||
onPageChangeEnd(page, currIndex) {
|
||||
this.currIndex = +currIndex;
|
||||
this.$emit('pagechange:end', page, currIndex);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,24 +1,56 @@
|
||||
@import './common/var.css';
|
||||
|
||||
@component-namespace zan {
|
||||
@b swipe {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
@b swipe {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@e indicators {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
@b swipe-item {
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
@e indicator {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
display: inline-block;
|
||||
border-radius: 100%;
|
||||
background: #999;
|
||||
opacity: .8;
|
||||
margin: 0 3px;
|
||||
z-index: 1;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
display: block;
|
||||
}
|
||||
@m active {
|
||||
background: $c-orange;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@e items {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@b swipe-item {
|
||||
display: none;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user