2019-04-11 00:12:23 +02:00
|
|
|
<template lang="html">
|
2019-06-03 13:06:44 +02:00
|
|
|
<div :id="id">
|
2019-06-06 17:37:43 +02:00
|
|
|
<!-- <router-view name="home" :html="home_template_src"></router-view> -->
|
|
|
|
<!-- <router-view name="base"></router-view> -->
|
|
|
|
<router-view :html="home_template_src"/>
|
2019-06-03 13:06:44 +02:00
|
|
|
</div>
|
2019-04-11 00:12:23 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState, mapActions } from 'vuex'
|
|
|
|
|
2019-06-04 22:38:44 +02:00
|
|
|
import { MA } from 'vuejs/api/ma-axios'
|
2019-06-03 13:06:44 +02:00
|
|
|
import router from 'vuejs/route'
|
|
|
|
|
2019-04-11 00:12:23 +02:00
|
|
|
export default {
|
2019-06-03 13:06:44 +02:00
|
|
|
router,
|
2019-06-04 22:38:44 +02:00
|
|
|
props:['id','html', 'isfront'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
home_template_src: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeMount() {
|
|
|
|
// console.log('MainContent beforeMount this.html', this.html);
|
|
|
|
if(!this.home_template_src){
|
|
|
|
// console.log('no home_template_src');
|
|
|
|
if(this.html && this.isfront){ // if html prop is available and we are landing on home then record it has data
|
|
|
|
this.home_template_src = this.html
|
|
|
|
}else{ // else get it from ajax (e.g. if we didn't load the page from home)
|
|
|
|
this.getHomeHtml()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getHomeHtml(){
|
|
|
|
MA.get('materio_home/ajax/gethome')
|
|
|
|
.then(({data}) => {
|
|
|
|
// console.log('Home getHomeHtml data', data);
|
|
|
|
this.home_template_src = data.rendered // record the html src into data
|
|
|
|
})
|
|
|
|
.catch(( error ) => {
|
|
|
|
console.warn('Issue with getHomeHtml', error)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2019-04-11 00:12:23 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2019-05-23 18:11:06 +02:00
|
|
|
|
2019-04-11 00:12:23 +02:00
|
|
|
</style>
|