-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcategory.js
More file actions
41 lines (34 loc) · 1.11 KB
/
Copy pathcategory.js
File metadata and controls
41 lines (34 loc) · 1.11 KB
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
new Vue({
el: '#document-list',
data: {
list: []
},
created: function() {
var thisName = document.getElementById('thisName').value;
var _this = this;
axios
.get('/data/wikilist.json', {})
.then(function(resp) {
if (resp.data == null) {
return;
}
var data = resp.data;
var list = [];
Object.keys(data)
.forEach(function(key){
var item = data[key];
if (item.parent == thisName) {
item.url = '/wiki/'.concat(key);
item.updated = item.updated.replace(/(^\d{4}.\d{2}.\d{2}).*/, '$1');
list.push(item);
}
});
list.sort(function(a,b) {
return a.title.toLowerCase()
.localeCompare(b.title.toLowerCase());
});
_this.list = list;
return;
});
}
});