/
main-diff.js
57 lines (55 loc) · 1.43 KB
/
main-diff.js
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
import Cue from './src/cue'
new Cue({ // eslint-disable-line
querySelector: '.app',
name: 'root',
data() {
return {
items: [
{ id: 1, val: 'A' },
{ id: 2, val: 'B' },
{ id: 3, val: 'C' }
]
}
},
methods: {
clickHandler() {
this.items.reverse().push({ id: 4, val: 'D' })
}
},
render: function (createElement) {
if (this.items.length) {
return createElement(
'div',
{},
[
createElement(
'button',
{
on: {
click: () => this.clickHandler()
}
},
'nice'
),
createElement(
'ul',
{},
this.items.map(function (item) {
return createElement(
'li',
{ key: item.id },
item.val
)
})
)
]
)
}
}
})
// something for parcel
if (module.hot) {
module.hot.dispose(() => {
window.location.reload()
})
}