FranckFreiburger / vue3-sfc-loader

Single File Component loader for Vue2 and Vue3. Load .vue files directly from your HTML. No node.js environment, no build step.
MIT License
1.19k stars 127 forks source link

css in jsx not scoped #186

Closed mustapha-wang closed 2 months ago

mustapha-wang commented 8 months ago

if use jsx,the scoped css not applied.


<script setup lang="jsx">
  console.log('sfc setup');
  const My=function(){return(
    <>
      <span class='red'>red</span>
      <h1>china,shanghai</h1>
    </>
  )}
</script>

<template>
  <My />
</template>

<style scoped>
  h1{
    font-size: large;
    color:red;
  }
  .red{
    color:red;
  }
</style>
`
FranckFreiburger commented 2 months ago

Unfortunately, it seems that this issue is not related to vue3-sfc-loader.

Please try with Vue SFC Playground: https://play.vuejs.org/#eNp9Uk1PwzAM/StRTkwanSY4lW4SoB1A4kPAMZcqdduMNInidGxM++84KfsQQju0td97sZ+dbvmtc9mqB57zAqVXLjCE0DumS9PMBF/iWvC5MNIatBoybZsLwbGWg0zw0c1ABva0YTNW90YGZQ27GLGtMIx5knlKY8xYQaXilyJ0pWFSl4jUxkNFbehdTCJ+VLXTuWyVKcfYkqG2VMWEoN9ikxREBzt66GgagEBKAnROlwGSpCBvUVxMTmBKMWw0MJTWQUVIOx0819aES1TfkNMafANUnDFptfU5zVPFfsJkFA3yvwwZiXXnfMwD1Ta1arIlWkM7TnrBpe2c0uBfXNwVCp4PlSJXam2/HhMWfA/jPS5bkJ//4OmGcgpePSD4FQh+4EJ0HwZ68f4Ma4oPZGerXpP6DPkGdOl99DjI7npTke0TXXL70DnrgzLNBy7WAQzuh4pGo3KX9ILTj3Z/ZvSj3avsOp2jffLdD+Eq3eE=