Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork186
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
如题,跑起来之后会报错,如果该页面不使用@use而是直接把样式写到style里面就没有这个问题。使用@import会在控制台打印一大堆的警告信息,没有办法解决了,求助啊!!! vite.configpreprocessorOptions:{// 全局样式引入scss:{additionalData:'@use "@/styles/var.scss" as *;',javascriptEnabled:true}} 详细请查看附件里面的例子<style lang="scss" scoped>@use'./page.scss'</style> |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment
-
根据问题描述,问题出在Vite配置的SCSS全局变量未正确注入到通过@use引入的文件中。以下是逐步解决方案:
在vite.config.js中,确认@别名指向src目录: 然后在组件中直接使用变量,无需@use引入。
最终配置推荐 组件使用示例: |
BetaWas this translation helpful?Give feedback.
All reactions
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment