Subscribe on changes!

Get scoped class name from `useAttrs`

avatar
May 26th 2023

What problem does this feature solve?

I want to set inheritAttrs: false and use class and style attributes in root element, but other in child element. It's not possible when I use <style scoped>.

What does the proposed API look like?

Now I have:

<script>
  defineOptions({ inheritAttrs: true });
</script>
<template>
  <label>
    <input v-bind="omit(attrs, ['class', 'style'])" />
  </label>
</template>

and I want:

<script>
  defineOptions({ inheritAttrs: false });
</script>
<template>
  <label v-bind="pick(attrs, ['class', 'style'])">
    <input v-bind="omit(attrs, ['class', 'style'])" />
  </label>
</template>
avatar
May 26th 2023

I'm not sure if I understand what you are asking for, but I assume you want the v-data-xxxx scope attribute to be included in attrs?

If so, I'm afraid that is not something we will support. It violates the scoping rules (only root node of child shares parent scope), and will also be a breaking change.