forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQCarouselControl.js
More file actions
37 lines (32 loc) · 926 Bytes
/
QCarouselControl.js
File metadata and controls
37 lines (32 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { h, computed } from 'vue'
import { createComponent } from '../../utils/private/create.js'
import { hSlot } from '../../utils/private/render.js'
export default createComponent({
name: 'QCarouselControl',
props: {
position: {
type: String,
default: 'bottom-right',
validator: v => [
'top-right', 'top-left',
'bottom-right', 'bottom-left',
'top', 'right', 'bottom', 'left'
].includes(v)
},
offset: {
type: Array,
default: () => [ 18, 18 ],
validator: v => v.length === 2
}
},
setup (props, { slots }) {
const classes = computed(() => `q-carousel__control absolute absolute-${ props.position }`)
const style = computed(() => ({
margin: `${ props.offset[ 1 ] }px ${ props.offset[ 0 ] }px`
}))
return () => h('div', {
class: classes.value,
style: style.value
}, hSlot(slots.default))
}
})