-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
105 lines (96 loc) · 2.63 KB
/
index.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
window.onload = function () {
let root = document.querySelector('#root');
let minx_data = {
title: 'Minx-Test',
user: 'ffiirree',
message: "Minx is a MVVM framework.",
url: 'https://firstsnow.me',
name: {
first: 'first',
last: 'last'
},
fns: {
print(str) {
return 'hello, ' + str;
}
},
list: [
{
id: 1,
creator: 'ffiirree',
content: 'write Minx',
status: 'undone',
date: '2017-11-8',
members: [
{ name: '张三' },
{ name: '李四' }
]
},
{
id: 2,
creator: 'ice',
content: 'Test Minx',
status: 'done',
date: '2017-11-8',
members: [
{ name: '王二' },
{ name: 'SB'}
]
}
]
};
let minx = new Minx({
$: '#root',
data: minx_data,
methods: {
click: function (arg) {
alert(arg);
},
print: function (event) {
console.log(event)
},
push: function () {
minx_data.list.push({
id: 3,
creator: 'zlq',
content: 'write Observer',
status: 'undone',
date: '2017-11-9',
members: [
{ name: 'zz' },
{ name: '2333' }
]
});
},
pop: function () {
minx_data.list.pop();
},
reverse: function () {
minx_data.list.reverse();
},
shift: function () {
minx_data.list.shift();
},
unshift: function () {
minx_data.list.unshift({
id: 0,
creator: 'zhang',
content: 'write Observer',
status: 'undone',
date: '2017-11-9',
members: [
{ name: '45345345' },
{ name: '4543532' }
]
});
},
splice: function () {
minx_data.list.splice(1, 2);
},
sort: function () {
minx_data.list.sort();
}
}
});
// console.log(minx);
};