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