Add app store

This commit is contained in:
2020-09-16 11:15:26 +03:00
parent 5d33377a50
commit 9482f7e359
13 changed files with 168 additions and 65 deletions

View File

@@ -2,7 +2,7 @@
<div id="app">
<div class="left-panel"
:class="{'left-panel-closed': leftPanelClosed}">
<LeftPanel @closeLeftPanel="closeLeftPanel()"></LeftPanel>
<LeftPanel></LeftPanel>
</div>
<div class="content w-100"
:class="{'content-when-left-panel-open': !leftPanelClosed}">
@@ -45,6 +45,8 @@ import LeftPanel from '@/components/LeftPanel.vue'
import LottieAnimation from "lottie-vuejs/src/LottieAnimation.vue";
import { StoreType } from '@/store';
interface AnimData {
direction: number;
currentTime: number;
@@ -73,8 +75,6 @@ interface ILottieAnimation {
},
})
export default class App extends Vue {
public leftPanelClosed: boolean = true;
@Ref('close-icon') public readonly closeIcon!: ILottieAnimation;
setAnimController(controller: IAnimController) {
@@ -111,6 +111,17 @@ export default class App extends Vue {
this.leftPanelClosed = true;
}
get leftPanelClosed(): boolean {
return (this.$store as StoreType).state.app.leftPanelClosed;
}
set leftPanelClosed(value: boolean) {
const store = (this.$store as StoreType);
store.dispatch('app/setLeftPanelCloseStatus', value)
.catch(error => console.log(error));
}
}
</script>