Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Commit 748ee3e

Browse files
author
Łukasz Florczak
committed
Props mixin
1 parent 7801a15 commit 748ee3e

File tree

1 file changed

+225
-0
lines changed

1 file changed

+225
-0
lines changed

src/mixins/props.js

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
/**
2+
* Component props
3+
*/
4+
const mixin = {
5+
props: {
6+
// Depreciated
7+
arrows: {
8+
type: Boolean,
9+
default: true
10+
},
11+
12+
/**
13+
* Set the carousel to be the navigation of other carousels
14+
*/
15+
asNavFor: {
16+
type: Array,
17+
default: function () {
18+
return []
19+
}
20+
},
21+
22+
/**
23+
* Enable autoplay
24+
*/
25+
autoplay: {
26+
type: Boolean,
27+
default: false
28+
},
29+
30+
/**
31+
* Autoplay interval in milliseconds
32+
*/
33+
autoplaySpeed: {
34+
type: Number,
35+
default: 3000
36+
},
37+
38+
/**
39+
* Enable centered view when slidesToShow > 1
40+
*/
41+
centerMode: {
42+
type: Boolean,
43+
default: false
44+
},
45+
46+
/**
47+
* Slides padding in center mode
48+
*/
49+
centerPadding: {
50+
type: String,
51+
default: '15%'
52+
},
53+
54+
/**
55+
* Enable dot indicators/pagination
56+
*/
57+
dots: {
58+
type: Boolean,
59+
default: true
60+
},
61+
62+
/**
63+
* Enable fade effect
64+
*/
65+
fade: {
66+
type: Boolean,
67+
default: false
68+
},
69+
70+
/**
71+
* Infinite loop sliding
72+
*/
73+
infinite: {
74+
type: Boolean,
75+
default: true
76+
},
77+
78+
/**
79+
* Index of slide to start on
80+
*/
81+
initialSlide: {
82+
type: Number,
83+
default: 0
84+
},
85+
86+
/**
87+
* Enable mobile first calculation for responsive settings
88+
*/
89+
mobileFirst: {
90+
type: Boolean,
91+
default: true
92+
},
93+
94+
/**
95+
* Enable prev/next navigation buttons
96+
*/
97+
navButtons: {
98+
type: Boolean,
99+
default: true
100+
},
101+
102+
// Depreciated
103+
nextArrow: {
104+
type: String,
105+
default: null
106+
},
107+
108+
/**
109+
* All settings as one object
110+
*/
111+
options: {
112+
type: Object,
113+
default: () => null
114+
},
115+
116+
/**
117+
* Pause autoplay when a dot is hovered
118+
*/
119+
pauseOnDotsHover: {
120+
type: Boolean,
121+
default: false
122+
},
123+
124+
/**
125+
* Pause autoplay when a slide is hovered
126+
*/
127+
pauseOnHover: {
128+
type: Boolean,
129+
default: true
130+
},
131+
132+
// Depreciated
133+
prevArrow: {
134+
type: String,
135+
default: null
136+
},
137+
138+
/**
139+
* Object containing breakpoints and settings objects
140+
*/
141+
responsive: {
142+
type: Array,
143+
default: () => null
144+
},
145+
146+
/**
147+
* Enable right-to-left mode
148+
*/
149+
rtl: {
150+
type: Boolean,
151+
default: false
152+
},
153+
154+
/**
155+
* Number of slides to scroll
156+
*/
157+
slidesToScroll: {
158+
type: Number,
159+
default: 1
160+
},
161+
162+
/**
163+
* Number of slides to show
164+
*/
165+
slidesToShow: {
166+
type: Number,
167+
default: 1
168+
},
169+
170+
/**
171+
* Slide animation speed in milliseconds
172+
*/
173+
speed: {
174+
type: Number,
175+
default: 300
176+
},
177+
178+
/**
179+
* Transition timing function
180+
* Available: ease, linear, ease-in, ease-out, ease-in-out
181+
*/
182+
timing: {
183+
type: String,
184+
default: 'ease'
185+
},
186+
187+
/**
188+
* Disable Agile carousel
189+
*/
190+
unagile: {
191+
type: Boolean,
192+
default: false
193+
}
194+
},
195+
196+
data () {
197+
return {
198+
// Initial settings based on props
199+
initialSettings: {
200+
asNavFor: this.asNavFor,
201+
autoplay: this.autoplay,
202+
autoplaySpeed: this.autoplaySpeed,
203+
centerMode: this.centerMode,
204+
centerPadding: this.centerPadding,
205+
dots: this.dots,
206+
fade: this.fade,
207+
infinite: this.infinite,
208+
initialSlide: this.initialSlide,
209+
mobileFirst: this.mobileFirst,
210+
navButtons: this.navButtons,
211+
pauseOnDotsHover: this.pauseOnDotsHover,
212+
pauseOnHover: this.pauseOnHover,
213+
responsive: this.responsive,
214+
rtl: this.rtl,
215+
slidesToScroll: this.slidesToScroll,
216+
slidesToShow: this.slidesToShow,
217+
speed: this.speed,
218+
timing: this.timing,
219+
unagile: this.unagile
220+
}
221+
}
222+
}
223+
}
224+
225+
export default mixin

0 commit comments

Comments
 (0)