refs #3301 Rewrite Preferences with composition API

This commit is contained in:
AkiraFukushima 2022-05-07 15:12:03 +09:00
parent 050b1d4cf6
commit 225ab4a56f
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
1 changed files with 24 additions and 16 deletions

View File

@ -54,26 +54,34 @@
</el-container>
</template>
<script>
import { mapState } from 'vuex'
<script lang="ts">
import { defineComponent, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { useStore } from '@/store'
export default {
export default defineComponent({
name: 'preferences',
computed: {
...mapState({
primaryColor: state => state.App.theme.primary_color,
backgroundColor: state => state.App.theme.background_color
})
},
methods: {
close() {
this.$router.push({ path: '/', query: { redirect: 'home' } })
},
activeRoute() {
return this.$route.path
setup() {
const store = useStore()
const router = useRouter()
const route = useRoute()
const primaryColor = computed(() => store.state.App.theme.primary_color)
const backgroundColor = computed(() => store.state.App.theme.background_color)
const close = () => {
router.push({ path: '/', query: { redirect: 'home' } })
}
const activeRoute = () => route.path
return {
primaryColor,
backgroundColor,
close,
activeRoute
}
}
}
})
</script>
<style lang="scss" scoped>