Vueでkeep-aliveキャッシュdesroyed()は解決策を実行できません
親コンポーネント:使用シヨウ ,
≪サブコンポーネント|Subcomponents|oem_src≫:親コンポーネントにマウントする必要のないサブコンポーネント サブコンポーネントdesroyed()は実行できません.excludeは解決できません.
解決策:deactivated()、activated()で対応するイベントを実行
export default {
name: 'App',
data() {
return {
isFooter: true, //
}
},
created() {
this.isLoaded = false;
},
components: {
'app-home': Home,
'app-footer': Footer //
},
methods: {
public_footer: function(flag) { v-on
this.isFooter = flag;
}
}
}
≪サブコンポーネント|Subcomponents|oem_src≫:親コンポーネントにマウントする必要のないサブコンポーネント サブコンポーネントdesroyed()は実行できません.excludeは解決できません.
mounted() {
this.$emit("public_footer", false); // , isFooter true
},
destroyed() {
console.log(1111); //
this.$emit("public_footer", true) // , isFooter false
}
解決策:deactivated()、activated()で対応するイベントを実行
activated() { //
this.$emit("public_footer", false);
},
deactivated(){ //
console.log(1111); // 1111
this.$emit("public_footer", true) // isFooter true
}