Skip to content

Vue 3 scoped styles do not work on preview #63

@ardier16

Description

@ardier16

Description

When passing code prop as SFC with scoped styles like this:

<template>
  <p class="test">
    Test
  </p>
</template>

<style>
  .test {
    color: red;
  }
</style>

vue-live preview does not apply component styles

It's because component options in vue 3 runtime core accepts __scopeId prop (ref), instead of _scopeId like in vue 2 (ref).

If I use __scopeId instead of _scopeId on this line everything works fine.

options._scopeId = `data-${this.scope}`;

I think it should support both _scopeId and __scopeId for both vue 2 & vue 3 compability.

Reproduction link

https://codesandbox.io/s/cool-chaum-elh5i

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions