Merge pull request #679 from h3poteto/fix/preferences

Remove unnecesary state to fix preference's menu
This commit is contained in:
AkiraFukushima 2018-10-26 22:56:00 +09:00 committed by GitHub
commit 3b1242d1c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 33 deletions

View File

@ -3,7 +3,7 @@
<el-menu
v-if="!hide"
:default-active="activeRoute()"
class="el-menu-vertical account-menu"
class="el-menu-vertical account-menu"
:collapse="true"
:router="true"
:background-color="themeColor"

View File

@ -14,28 +14,28 @@
<div v-shortkey="['esc']" @shortkey="close"></div>
<el-aside width="240px" class="menu">
<el-menu
:default-active="defaultActive"
:default-active="activeRoute()"
class="setting-menu"
:text-color="primaryColor"
:background-color="backgroundColor"
:route="true">
<el-menu-item index="1" :route="{path: '/preferences/general'}" @click="general">
:router="true">
<el-menu-item index="/preferences/general">
<icon name="cog" class="icon" scale="1.3"></icon>
<span>{{ $t('preferences.general.title') }}</span>
</el-menu-item>
<el-menu-item index="2" :route="{path: '/preferences/appearance'}" @click="appearance">
<el-menu-item index="/preferences/appearance">
<icon name="palette" class="icon" scale="1.3"></icon>
<span>{{ $t('preferences.appearance.title') }}</span>
</el-menu-item>
<el-menu-item index="3" :route="{path: '/preferences/notification'}" @click="notification">
<el-menu-item index="/preferences/notification">
<icon name="bell" class="icon" scale="1.3"></icon>
<span>{{ $t('preferences.notification.title') }}</span>
</el-menu-item>
<el-menu-item index="4" :route="{path: '/preferences/account'}" @click="account">
<el-menu-item index="/preferences/account">
<icon name="user" class="icon" scale="1.3"></icon>
<span>{{ $t('preferences.account.title') }}</span>
</el-menu-item>
<el-menu-item index="5" :route="{path: '/preferences/language'}" @click="language">
<el-menu-item index="/preferences/language">
<icon name="language" class="icon" scale="1.3"></icon>
<span>{{ $t('preferences.language.title') }}</span>
</el-menu-item>
@ -55,7 +55,6 @@ export default {
name: 'preferences',
computed: {
...mapState({
defaultActive: state => state.Preferences.defaultActive,
primaryColor: state => state.App.theme.primary_color,
backgroundColor: state => state.App.theme.background_color
})
@ -63,22 +62,9 @@ export default {
methods: {
close () {
this.$router.push('/')
this.$store.commit('Preferences/changeActive', '1')
},
general () {
this.$router.push('/preferences/general')
},
notification () {
this.$router.push('/preferences/notification')
},
account () {
this.$router.push('/preferences/account')
},
language () {
this.$router.push('/preferences/language')
},
appearance () {
this.$router.push('/preferences/appearance')
activeRoute () {
return this.$route.path
}
}
}

View File

@ -77,7 +77,6 @@ export default {
})
},
created () {
this.$store.commit('Preferences/changeActive', '2')
this.loadAccounts()
},
methods: {

View File

@ -13,14 +13,8 @@ const Preferences = {
Notification,
Appearance
},
state: {
defaultActive: '1'
},
mutations: {
changeActive (state, value) {
state.defaultActive = value
}
}
state: {},
mutations: {}
}
export default Preferences