We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I tried to bind a unocss class using template strings to an element, the class won't be detected.
import { createApp } from "vue"; import App from "./App.vue"; import "uno.css"; createApp(App).mount("#app");
<script setup> import { ref } from "vue"; const color = ref("blue"); </script> <template> <div class="w-8 h-8" :class="[`bg-${color}`]"></div> <button @click="color = 'red'">Change color</button> </template>
import { defineConfig } from "vite"; import Vue from "@vitejs/plugin-vue"; import Unocss from "unocss/vite"; import { presetWind } from "unocss"; export default defineConfig({ plugins: [ Vue(), Unocss({ presets: [presetWind()], }), ], });
The text was updated successfully, but these errors were encountered:
This is expected behavior
Sorry, something went wrong.
Summery When I tried to bind a unocss class using template strings to an element, the class won't be detected. Example code main.js App.vue <script setup> import { ref } from "vue"; const color = ref("blue"); </script> <template> <div class="w-8 h-8" :class="[`bg-${color}`]"></div> <button @click="color = 'red'">Change color</button> </template> vite.config.js
main.js App.vue
vite.config.js
@chenghsuanhe I think unocss can’t dynamic caculate generate class at present. but we use utilities full-name, it's be usefully.
Okay, since this is a expected behavior, I will close this issue. Thanks.
No branches or pull requests
Summery
When I tried to bind a unocss class using template strings to an element, the class won't be detected.
Example code
main.js
App.vue
vite.config.js
The text was updated successfully, but these errors were encountered: