-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.vue
76 lines (73 loc) · 1.61 KB
/
App.vue
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<template>
<div id="app">
<div ref="container">
<h1 ref="title">Vue-gaspard</h1>
<h2>DOM helpers on components</h2>
<a ref="link">Helpful is vue-gaspard!</a>
<child ref="child" />
</div>
</div>
</template>
<script>
import Vue from 'vue'
export default {
name: 'app',
components: {
child: {
render (createElement) {
return createElement('img', {
style: {
display: 'block',
margin: '0 auto'
},
attrs: {
src: 'https://github.com/lucaperret/gaspard/raw/master/gaspard.png'
}
})
}
}
},
mounted () {
// Use gaspard global
Vue.$gaspard.addClass(document.documentElement, 'container')
Vue.$gaspard.fadeIn(this.$refs.title, 2000)
// Or on this component instance
this.$g.css('border', '1px dashed #eb592d')
// Find a child node and perform actions on it
this.$g
.find('h1')
.css('color', '#eb592d')
.addClass('big')
// On a referenced child element
this.$g
.find(this.$refs.link)
.attr('href', 'https://github.com/lucaperret/vue-gaspard')
// On a referenced child component
this.$refs.child.$g.css('border', '1px dotted #eb592d')
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
padding: 1em;
}
.container {
width: 60%;
margin: 0 auto;
}
.btnOrange {
background-color: #eb592d;
}
.big {
font-size: 3em;
}
a {
color: #eb592d
}
</style>