|
|
@@ -1,5 +1,6 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { ref } from 'vue'
|
|
|
+import { ref, onMounted, watch } from 'vue'
|
|
|
+import { useThemeStore } from '@/stores/modules/theme'
|
|
|
import BubbleLight from '../image/bubble_corner_colorful.png'
|
|
|
import BubbleDark from '../image/bubble_corner_colorful_darkmode.png'
|
|
|
const props = defineProps({
|
|
|
@@ -12,16 +13,34 @@ const emits = defineEmits(['submitDetails'])
|
|
|
const submitDetails = (val: any) => {
|
|
|
emits('submitDetails', val)
|
|
|
}
|
|
|
-const theme = localStorage.getItem('theme')
|
|
|
+const themeStore = useThemeStore()
|
|
|
+const ScoringRef = ref()
|
|
|
+// 判断当前系统主题模式
|
|
|
+onMounted(() => {
|
|
|
+ watch(
|
|
|
+ () => themeStore.theme,
|
|
|
+ (newVal) => {
|
|
|
+ if (newVal === 'dark') {
|
|
|
+ ScoringRef.value.classList.add('dark-bg')
|
|
|
+ } else {
|
|
|
+ ScoringRef.value.classList.remove('dark-bg')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ )
|
|
|
+})
|
|
|
</script>
|
|
|
<template>
|
|
|
- <div class="colorfulflex">
|
|
|
+ <div class="colorfulflex" ref="ScoringRef">
|
|
|
<div v-if="props.isshowexpression" class="dialogcolorful">
|
|
|
<div class="dialogue">
|
|
|
<img :src="props.colorfulSrc" />
|
|
|
</div>
|
|
|
<div class="vector">
|
|
|
- <img class="vector_img" :src="theme == 'light' ? BubbleLight : BubbleDark" />
|
|
|
+ <img class="vector_img" :src="themeStore.theme == 'light' ? BubbleLight : BubbleDark" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-if="props.isshowDetails" class="dialogcolorful submit">
|
|
|
@@ -41,7 +60,7 @@ const theme = localStorage.getItem('theme')
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="vector vector_submit">
|
|
|
- <img class="vector_img" :src="theme == 'light' ? BubbleLight : BubbleDark" />
|
|
|
+ <img class="vector_img" :src="themeStore.theme == 'light' ? BubbleLight : BubbleDark" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|