NuxtN
Nuxt4mo ago
10 replies
BinaryArtifex

tailwind classes injected via $attrs not applying styles

tailwind classes are not being applied when injecting them via vue's $attrs. inspecting the nested div in chrome, bg-black is indeed passed to it, but no styles are applied...

// FooComponent.vue
<template>
  <div>
    <div v-bind="$attrs">
      <slot />
    </div>
  </div>
</template>

<script lang="ts" setup>
  defineOptions({ inheritAttrs: false });
</script>

  // ParentComponent.vue
  <FooComponent class="bg-black">Foo Component</FooComponent>
Was this page helpful?