WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 08e559f

Browse files
committed
feat: Add Slider props to GallerySlider
1 parent e50936b commit 08e559f

File tree

4 files changed

+43
-31
lines changed

4 files changed

+43
-31
lines changed

dev/components/components/image-gallery.vue

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<template>
22
<div>
33
<div class="layout-padding">
4-
<h5>Gallery</h5>
4+
<p class="caption">Gallery</p>
55
<q-gallery :src="gallery"></q-gallery>
66

7-
<h5>Gallery Slider</h5>
7+
<p class="caption">Gallery Slider</p>
88
<q-gallery-slider :src="slider"></q-gallery-slider>
9+
10+
<p class="caption">Gallery Slider with Infinite Scroll & Autoplay</p>
11+
<q-gallery-slider dots infinite autoplay :src="secondSlider"></q-gallery-slider>
912
</div>
1013
</div>
1114
</template>
@@ -25,24 +28,11 @@ export default {
2528
slider: [
2629
'statics/mountains.jpg',
2730
'statics/parallax1.jpg',
28-
'statics/parallax2.jpg',
29-
'statics/parallax1.jpg',
30-
'statics/parallax2.jpg',
31-
'statics/mountains.jpg',
32-
'statics/mountains.jpg',
33-
'statics/parallax1.jpg',
34-
'statics/parallax2.jpg',
35-
'statics/parallax1.jpg',
36-
'statics/parallax2.jpg',
37-
'statics/mountains.jpg',
38-
'statics/parallax1.jpg',
39-
'statics/parallax2.jpg',
40-
'statics/parallax1.jpg',
41-
'statics/parallax2.jpg',
31+
'statics/parallax2.jpg'
32+
],
33+
secondSlider: [
4234
'statics/mountains.jpg',
4335
'statics/parallax1.jpg',
44-
'statics/parallax2.jpg',
45-
'statics/parallax1.jpg',
4636
'statics/parallax2.jpg'
4737
]
4838
}

src/vue-components/gallery/GallerySlider.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
<template>
22
<q-slider
3-
ref="slider" arrows fullscreen
3+
ref="slider"
44
@slide="__updateCurrentSlide"
5+
:dots="dots"
6+
:arrows="arrows"
7+
:fullscreen="fullscreen"
8+
:infinite="infinite"
9+
actions
10+
:animation="animation"
11+
:autoplay="autoplay"
512
class="text-white bg-black q-gallery-slider"
613
>
714
<div
@@ -39,11 +46,22 @@
3946
</template>
4047

4148
<script>
49+
import sliderMixin from '../slider/slider-mixin'
50+
4251
export default {
52+
mixins: [sliderMixin],
4353
props: {
4454
src: {
4555
type: Array,
4656
required: true
57+
},
58+
arrows: {
59+
type: Boolean,
60+
default: true
61+
},
62+
actions: {
63+
type: Boolean,
64+
default: true
4765
}
4866
},
4967
data () {

src/vue-components/slider/Slider.vue

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,10 @@ import { cssTransform } from '../../utils/dom'
5252
import { between, normalizeToInterval } from '../../utils/format'
5353
import animate from '../../utils/animate'
5454
import uid from '../../utils/uid'
55+
import sliderMixin from './slider-mixin'
5556
5657
export default {
57-
props: {
58-
arrows: Boolean,
59-
dots: Boolean,
60-
fullscreen: Boolean,
61-
infinite: Boolean,
62-
actions: Boolean,
63-
animation: {
64-
type: Boolean,
65-
default: true
66-
},
67-
autoplay: [Number, Boolean]
68-
},
58+
mixins: [sliderMixin],
6959
data () {
7060
return {
7161
position: 0,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default {
2+
props: {
3+
arrows: Boolean,
4+
dots: Boolean,
5+
fullscreen: Boolean,
6+
infinite: Boolean,
7+
actions: Boolean,
8+
animation: {
9+
type: Boolean,
10+
default: true
11+
},
12+
autoplay: [Number, Boolean]
13+
}
14+
}

0 commit comments

Comments
 (0)