-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
26 lines (24 loc) · 855 Bytes
/
app.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
document.addEventListener("DOMContentLoaded", () => {
const app = new Vue({
el: '#app',
data: {
header: 'Battle View',
characters: [],
selectedIndex: -1,
activeTabName: 'desc'
},
computed: {
character() { return this.characters[this.selectedIndex]; }
},
methods: {
load: async () => {
const sortAsc = (c1,c2) => (c1.name < c2.name ? -1 : c1.name > c2.name ? 1 : 0);
const chars = account.realmCharacters;
const fields = bnet.fieldsProf;
app.characters = [];
app.selectedIndex = -1;
app.characters = (await bnet.getCharacters(chars,fields)).sort(sortAsc);
}
}
});
});