Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.0 KiB
63 lines
1.0 KiB
4 years ago
|
<template>
|
||
|
<div id="app">
|
||
|
<div id="loading" v-if="loading">
|
||
|
Loading...
|
||
|
</div>
|
||
|
<!--pre>
|
||
|
{{item}}
|
||
|
</pre-->
|
||
|
<TreeNode :item="item"/>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import TreeNode from './TreeNode.vue'
|
||
|
import axios from 'axios'
|
||
|
export default {
|
||
|
name: 'App',
|
||
|
components: {
|
||
|
TreeNode,
|
||
|
},
|
||
|
data: () => ({
|
||
|
loading: true,
|
||
|
item: null,
|
||
|
tnid: 1
|
||
|
}),
|
||
|
props:{
|
||
|
tnid: Number
|
||
|
},
|
||
|
mounted: function() {
|
||
|
this.getArticles();
|
||
|
this.$root.$on('updateData',(arg) => {
|
||
|
console.log(arg);
|
||
|
this.getArticles();
|
||
|
});
|
||
|
},
|
||
|
methods: {
|
||
|
getArticles: function() {
|
||
|
this.loading = true;
|
||
|
axios.get('/treenode/'+this.tnid+'/json/')
|
||
|
.then((response) => {
|
||
|
this.item = response.data;
|
||
|
this.loading = false;
|
||
|
console.log('Data updated');
|
||
|
this.$root.$emit('dataUpdated',"dataUpdated");
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
this.loading = false;
|
||
|
console.log(err);
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
events: {
|
||
|
updateData: function(){
|
||
|
this.getArticles()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
@import '../../../mamweb/static/css/mamweb.css';
|
||
|
</style>
|