lg_frontend/layouts/default.vue

47 lines
700 B
Vue

<template>
<div>
<nuxt />
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
name: "default",
computed: {
...mapState({
info: state => state.system.info
})
},
watch: {
'$route': {
immediate: true,
deep: true,
handler(to) {
if (to.path.indexOf('login') < 0) {
this.getViewData()
}
}
}
},
created() {
},
methods: {
...mapActions('system', ['setInfo']),
async getViewData () {
if (!this.info) {
const { data } = await this.$get('/api/Home/view');
this.setInfo(data)
}
}
}
}
</script>
<style scoped lang="less">
</style>