forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageFun.vue
More file actions
58 lines (49 loc) · 1.19 KB
/
ImageFun.vue
File metadata and controls
58 lines (49 loc) · 1.19 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
<div class="overflow-hidden">
<q-resize-observer @resize="onResize" :debounce="0" />
<q-splitter
id="photos"
v-model="splitterModel"
:limits="[0, 100]"
:style="splitterStyle"
before-class="overflow-hidden"
after-class="overflow-hidden"
>
<template v-slot:before>
<img
src="https://cdn.quasar.dev/img/parallax1.jpg"
:width="width"
class="absolute-top-left"
/>
</template>
<template v-slot:after>
<img
src="https://cdn.quasar.dev/img/parallax1-bw.jpg"
:width="width"
class="absolute-top-right"
/>
</template>
</q-splitter>
</div>
</template>
<script>
import { ref, computed } from 'vue'
export default {
setup () {
const width = ref(400)
return {
width,
splitterModel: ref(50), // start at 50%
splitterStyle: computed(() => ({
height: Math.min(600, 0.66 * width.value) + 'px',
width: width.value + 'px'
})),
// we are using QResizeObserver to keep
// this example mobile-friendly
onResize (info) {
width.value = info.width
}
}
}
}
</script>