Tomas "Jethro" Pokorny
4 years ago
7 changed files with 99 additions and 57 deletions
@ -0,0 +1,62 @@ |
|||
<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> |
@ -1,10 +1,12 @@ |
|||
import Vue from 'vue' |
|||
import App from './App.vue' |
|||
import router from './router' |
|||
import CKEditor from '@ckeditor/ckeditor5-vue' |
|||
|
|||
Vue.config.productionTip = false |
|||
Vue.use(CKEditor); |
|||
|
|||
new Vue({ |
|||
render: h => h(App), |
|||
router, |
|||
render: h => h(App), |
|||
}).$mount('#app') |
|||
|
@ -0,0 +1,23 @@ |
|||
import Vue from 'vue' |
|||
import Router from 'vue-router' |
|||
import TreeNodeRoot from '../components/TreeNodeRoot.vue' |
|||
|
|||
Vue.use(Router) |
|||
|
|||
export default new Router({ |
|||
mode: 'history', |
|||
linkActiveClass: 'active', |
|||
routes: [{ |
|||
path: '/temp/vue', |
|||
name: 'treenodedefault', |
|||
props: {'tnid': 1}, |
|||
component: TreeNodeRoot |
|||
}, { |
|||
path: '/temp/vue/:tnid', |
|||
name: 'treenode', |
|||
props: true, |
|||
component: TreeNodeRoot |
|||
}, |
|||
] |
|||
}) |
|||
|
Loading…
Reference in new issue