Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use <style vars> ? #578

Closed
pangao66 opened this issue Jul 19, 2020 · 4 comments
Closed

how to use <style vars> ? #578

pangao66 opened this issue Jul 19, 2020 · 4 comments

Comments

@pangao66
Copy link

I use the style vars as the document example

export default {
  data () {
    return {
      color: 'red'
    }
  }
}
</script>
<style vars="{ color }">
  .text {
    color: var(--color);
  }
</style>

but it does not work
Uncaught SyntaxError: The requested module '/@modules/vue.js' does not provide an export named 'useCSSVars'

@underfin
Copy link
Member

Install vue lasted versions and use vite --force remove old cache.

@pangao66
Copy link
Author

image
image

I create a new project with npm init vite-app vite-demo
but it still doesn't work
the picture I provide above is the code I write
are there any problem ?
the console error
Uncaught SyntaxError: The requested module '/@modules/vue.js' does not provide an export named 'useCSSVars

@pangao66
Copy link
Author

when I use the script setup It works

<script setup>

export const color = 'red';
</script>
<style vars="{ color }" scoped>

  .text {
    color: var(--color);
  }
</style>

use the options api data return it still doesn't work

@yyx990803
Copy link
Member

Close via vuejs/core#1658 (pending release)

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants