refactor: migrate to <script setup>

This commit is contained in:
mrholek
2024-04-29 13:51:42 +02:00
parent 86a084aa4f
commit 43745d958a
63 changed files with 1056 additions and 1754 deletions
+24 -26
View File
@@ -1,38 +1,36 @@
<template>
<router-view />
</template>
<script>
<script setup>
import { onBeforeMount } from 'vue'
import { useStore } from 'vuex'
import { useColorModes } from '@coreui/vue'
export default {
setup() {
const { isColorModeSet, setColorMode } = useColorModes(
'coreui-free-vue-admin-template-theme',
)
const store = useStore()
const { isColorModeSet, setColorMode } = useColorModes('coreui-free-vue-admin-template-theme')
const store = useStore()
onBeforeMount(() => {
const urlParams = new URLSearchParams(window.location.href.split('?')[1])
const theme =
urlParams.get('theme') &&
urlParams.get('theme').match(/^[A-Za-z0-9\s]+/)[0]
if (theme) {
setColorMode(theme)
return
}
onBeforeMount(() => {
const urlParams = new URLSearchParams(window.location.href.split('?')[1])
let theme = urlParams.get('theme')
if (isColorModeSet()) {
return
}
if (theme !== null && theme.match(/^[A-Za-z0-9\s]+/)) {
theme = theme.match(/^[A-Za-z0-9\s]+/)[0]
}
setColorMode(store.state.theme)
})
},
}
if (theme) {
setColorMode(theme)
return
}
if (isColorModeSet()) {
return
}
setColorMode(store.state.theme)
})
</script>
<template>
<router-view />
</template>
<style lang="scss">
// Import Main styles for this application
@import 'styles/style';