Fixed electron vue state issue, Added Sidebar state and Added sidebar icon on click and removed redundent Counter state
parent
dd9ee29615
commit
d4ef91614c
|
|
@ -1,3 +1,4 @@
|
|||
test/unit/coverage/**
|
||||
test/unit/*.js
|
||||
test/e2e/*.js
|
||||
src/main/*.js
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
|
||||
import store from '../renderer/store/index'
|
||||
/**
|
||||
* Set `__static` path to static files in production
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<section class="handle">
|
||||
<div class="icon">
|
||||
<div @click="toggleMenuStatus" class="icon">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 384.97 384.97" style="enable-background:new 0 0 384.97 384.97;" xml:space="preserve">
|
||||
<g>
|
||||
<g id="Menu_1_">
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
</div>
|
||||
<Logo :nopadding="true"/>
|
||||
</section>
|
||||
<section class="sidebar">
|
||||
<section class="sidebar" :class="{'open': menuStatus === true}">
|
||||
<Logo class="logo" />
|
||||
<MenuGroup>
|
||||
<template v-slot:title>Menu</template>
|
||||
|
|
@ -105,12 +105,18 @@ import MenuGroup from '../components/MenuGroup'
|
|||
import MenuItem from '../components/MenuItem'
|
||||
import projectPackage from '~/package.json'
|
||||
import Logo from '../components/Logo'
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'DockableSidebar',
|
||||
components: { MenuGroup, MenuItem, Logo },
|
||||
data: () => {
|
||||
return { version: projectPackage.version }
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['toggleMenuStatus'])
|
||||
},
|
||||
computed: mapGetters(['menuStatus'])
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
const state = {
|
||||
main: 0
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
DECREMENT_MAIN_COUNTER (state) {
|
||||
state.main--
|
||||
},
|
||||
INCREMENT_MAIN_COUNTER (state) {
|
||||
state.main++
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
someAsyncTask ({ commit }) {
|
||||
// do something async
|
||||
commit('INCREMENT_MAIN_COUNTER')
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
const state = {
|
||||
menu_open: false
|
||||
}
|
||||
|
||||
const getters = {
|
||||
menuStatus: (state) => state.menu_open
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
TOGGLE_MENU (state) {
|
||||
state.menu_open = !state.menu_open
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
toggleMenuStatus ({ commit }) {
|
||||
commit('TOGGLE_MENU')
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
actions,
|
||||
state,
|
||||
mutations,
|
||||
getters
|
||||
}
|
||||
Loading…
Reference in New Issue