Skip to content

data classes aren't working in vue3 + daisyUIΒ #14

@xrayian

Description

@xrayian

What I tried

While testing it did work once and I saw the local storage write the changed theme value, but after a cache clear it didn't work at all.
I am using vue 3 composition api. I might be able to get it to work manually setting local storage values but I wanted to understand. why this isn't working.

What isn't working

Selecting from the dropdown isn't doing anything.
Also typescript is throwing errors for the missing type declarations

Some relevant code

you can see the full project here
my navbar.vue

<script setup lang="ts">
import { computed, onMounted } from 'vue';
//...
import { themeChange } from 'theme-change';

//...

onMounted(() => {
    themeChange(false)
})

</script>

<template>
// nav component classes ...
  <li tabindex="0">
      <a>
          🎨 Theme
          <svg class="fill-current" xmlns="http://www.w3.org/2000/svg" width="20" height="20"
              viewBox="0 0 24 24">
              <path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z" />
          </svg>
      </a>
      <ul class="p-2 bg-base-100" data-choose-theme>
          <li>
              <a data-set-theme="dracula" data-act-class="outline">Dracula</a>
          </li>
          <li>
              <a data-set-theme="emerald" data-act-class="outline">Emerald</a>
          </li>
          <li>
              <a data-set-theme="garden" data-act-class="outline">Garden</a>
          </li>
          <li>
              <a data-set-theme="light" data-act-class="outline">Light</a>
          </li>
          <li>
              <a data-set-theme="dark" data-act-class="outline">Dark</a>
          </li>
      </ul>
</li>
// ...
</template>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions