-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparent.js
More file actions
39 lines (36 loc) · 1.11 KB
/
Copy pathparent.js
File metadata and controls
39 lines (36 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
new Vue({
el: '#parent-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 plist = [];
var target = encodeURI(thisName);
for(var i = 0; i < 100; i++) {
if (target == 'index') {
break;
}
var next = data[target];
if (!next || !next['parent'] || next['parent'].length < 1) {
break;
}
next['url'] = '/wiki/'.concat(target)
plist.unshift(next);
target = encodeURI(next['parent']);
}
plist.pop();
_this.list = plist;
window.list = plist;
return;
});
}
});