Home.vue
832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png" >
<span v-if="isQiankun" @click="changeParentState"></span>
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
export default {
name: 'Home',
components: {
HelloWorld
},
data() {
return {
num: 0,
isQiankun: window.__POWERED_BY_QIANKUN__,
}
},
computed: {
commonData(){
return this.isQiankun ? this.$root.parentVuex.state.commonData : '';
}
},
mounted() {
console.log('app-vue-hash Home.vue mounted')
},
methods: {
changeParentState(){
if(this.isQiankun){
this.$root.parentVuex.commit('setCommonData', { parent: this.num++ });
}
}
},
}
</script>