Skip to content

Does not work as expectation #1

@chobitsnerv

Description

@chobitsnerv

Hi, Thank you for sharing such a wonderful lib.
I'd like to share the following info I noticed after using it.

  1. The following part will lead to error if this lib is used under vite. Maybe it‘s better to use "import" instead of require.
const {
          enable: enableDarkMode,
          disable: disableDarkMode,
        } = require("darkreader");
  1. I have try to use as following in my app.vue
import Interpolator from "utils/vue-apply-darkmode.esm.js";

const isDarkMode = ref(false);
const isAutoMode = ref(false);

<Interpolator :dark="isDarkMode " :watch-system="isAutoMode ">
</Interpolator >

However, the props can be updated indeed but
activeDark
systemDark
will not be changed at all.
The dist file is referred as [1].
I’m not sure if there's any lacking of bding between the props and local varibales.
DevEnv : vue3, vite

  1. I checked the src and it looks watchSystem is never been used.
  2. currently I'm usng ref to access the component Interpolator directly, I can turn on and off for dark mode by following:
 nightmodecomp.value.activeDark = false;
 nightmodecomp.value.systemDark = true;

<Interpolator ref="nightmodecomp">

 </Interpolator>

But it looks systemDark does not work corrctly.
I guess the related logic may not support to do so since it should be expected to use "watchSystem" actually.

Please correct me if I misunderstand anything, looking forward to your reply and help.

Thanks in advance.

[1] : https://github.com/valisoftworks/vue-apply-darkmode/blob/release/dist/vue-apply-darkmode.esm.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions