forked from coldemo/gallery.code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvue-render-h.js
More file actions
30 lines (28 loc) · 716 Bytes
/
vue-render-h.js
File metadata and controls
30 lines (28 loc) · 716 Bytes
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
// await loadJs('https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js')
await loadJs('https://unpkg.com/[email protected]/dist/vue.min.js')
appendCss(`
.container { padding: 20px }
`)
let App = {
render (h) {
let { add, count, message } = this
return h('div', { class: 'container' }, [
h('h1', null, 'Vue Render-h'),
h('h3', null, `Hello. ${message} ${count}`),
h('button', { on: { click: add } }, 'Add')
])
},
data() {
return { count: 0, message: 'This is Vue App.' }
},
mounted() {
this.timerId = setInterval(this.add, 1000)
},
beforeDestroy() {
let { timerId } = this
if (timerId) clearInterval(timerId)
},
methods: {
add() { this.count++ }
}
}