fix: darkMode plugin
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { defineEmits, defineExpose, defineProps, watch, ref, onMounted } from 'vue';
|
||||
import { defineEmits, defineExpose, defineProps, watch, ref, onMounted, getCurrentInstance } from 'vue';
|
||||
|
||||
import VueHcaptcha from '@hcaptcha/vue3-hcaptcha';
|
||||
import { RecaptchaV2, useRecaptcha } from "vue3-recaptcha-v2";
|
||||
@@ -80,7 +80,7 @@ defineExpose({
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
console.log(props);
|
||||
console.log(getCurrentInstance().appContext.config.globalProperties.$darkMode);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
+2
-4
@@ -3,12 +3,10 @@ import { reactive } from 'vue';
|
||||
const darkModeMediaQuery = '(prefers-color-scheme: dark)';
|
||||
const matchMedia = window.matchMedia(darkModeMediaQuery);
|
||||
|
||||
const darkMode = reactive({
|
||||
value: matchMedia.matches,
|
||||
});
|
||||
const darkMode = reactive(matchMedia.matches);
|
||||
|
||||
matchMedia.addEventListener('change', (event) => {
|
||||
darkMode.value = event.matches;
|
||||
darkMode = event.matches;
|
||||
});
|
||||
|
||||
export const install = (app) => {
|
||||
|
||||
Reference in New Issue
Block a user