-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
49 lines (48 loc) · 1.37 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vue media query directive</title>
</head>
<body>
<div id='app'>
<span v-text='$mm.resize'></span>
<vue-test v-show="$mm.resize && $mm.notHD()">notHD</vue-test>
<vue-test v-show="$mm.resize && $mm.expr('(min-width: 600px)')">expr</vue-test>
<vue-test v-show="$mm.resize && $mm.between([$vv.screenXs, 1920])">between</vue-test>
<vue-test v-show="$mm.resize && $mm.beyond([$vv.screenXs, 1000])">beyond</vue-test>
<vue-test v-show="$mm.above($vv.screenXs)">above</vue-test>
<vue-test v-show="$mm.resize && $mm.below(1200)">below</vue-test>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.2/vue.js" charset="utf-8"></script>
<script src="./dist/v-media-query.js"></script>
<script>
Vue.use(vMediaQuery.default, {
nameSpace: {
methods: '$mm',
variables: '$vv',
},
methods: {
notHD() {
return window.innerWidth !== 1920
},
itHD() {
return window.innerWidth === 1920
},
},
variables: {
screenXs: 600,
screenHd: 1920
}
});
new Vue({
el: '#app',
components: {
'vue-test': {
template: '<div><slot></slot> <span v-text="$mm.resize"></span> <span>text</span></div>',
}
}
})
</script>
</body>
</html>