forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbreakpoints.vue
More file actions
57 lines (56 loc) · 1.13 KB
/
breakpoints.vue
File metadata and controls
57 lines (56 loc) · 1.13 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
<template>
<div class="layout-padding">
<div v-for="type in types" :class="type">{{type}}</div>
<q-window-resize-observable @resize="resize" />
<p class="caption" :class="`bg-${color}`">{{w}} - {{width}}</p>
</div>
</template>
<script>
export default {
data () {
return {
width: 0,
types: ['xs', 'gt-xs', 'lt-sm', 'sm', 'gt-sm', 'lt-md', 'md', 'gt-md', 'lt-lg', 'lg', 'gt-lg', 'lt-xl', 'xl']
}
},
computed: {
w () {
if (this.width <= 575) {
return 'xs'
}
if (this.width <= 767) {
return 'sm'
}
if (this.width <= 991) {
return 'md'
}
if (this.width <= 1199) {
return 'lg'
}
return 'xl'
},
color () {
if (this.w === 'xs') {
return 'yellow-2'
}
if (this.w === 'sm') {
return 'yellow-4'
}
if (this.w === 'md') {
return 'yellow-6'
}
if (this.w === 'lg') {
return 'yellow-8'
}
return 'yellow-10'
}
},
methods: {
resize ({width}) {
if (width !== this.width) {
this.width = width
}
}
}
}
</script>