retro/static/index.js

35 lines
958 B
JavaScript

var app = new Vue({
el: '#app',
delimiters: ['[[',']]'],
data() {
return {
perks: [],
backgrounds: [],
perk: {},
background: {},
trait: {},
stats: {}
}
},
created() {
axios.get('/data')
.then(resp => {
this.backgrounds = resp.data.backgrounds
this.perks = resp.data.perks
this.perk = resp.data.perks[0]
this.background = resp.data.backgrounds[0]
this.trait = resp.data.backgrounds[0].traits[0]
})
.catch(err => console.log(err))
this.reset_stats()
},
methods: {
reset_trait() {
this.trait = this.background.traits[0]
},
reset_stats() {
axios.get('/stats')
.then(resp => this.stats = resp.data)
}
}
})