forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasic.vue
More file actions
52 lines (46 loc) · 1.15 KB
/
Basic.vue
File metadata and controls
52 lines (46 loc) · 1.15 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
<template>
<div class="q-pa-md q-gutter-md">
<q-btn color="primary" push @click="setRandomSize" label="Set Random Size" />
<div :style="style" class="container bg-amber rounded-borders glossy">
<!--
we listen for size changes on this next
<div>, so we place the observer as direct child:
-->
<q-resize-observer @resize="onResize" />
</div>
<div class="q-gutter-sm">
Reported:
<q-badge>width: {{ report.width }}</q-badge>
<q-badge>height: {{ report.height }}</q-badge>
</div>
</div>
</template>
<script>
export default {
data () {
return {
style: { width: '200px', height: '200px' },
report: ''
}
},
methods: {
onResize (size) {
this.report = size
// {
// width: 20 // width of container (in px)
// height: 50 // height of container (in px)
// }
},
setRandomSize () {
this.style = {
width: Math.floor(100 + Math.random() * 200) + 'px',
height: Math.floor(100 + Math.random() * 200) + 'px'
}
}
}
}
</script>
<style lang="sass" scoped>
.container
transition: width .3s, height .3s
</style>