全局scss变量

文件路径

src/styles/variables.scss

作用

可以在项目内组件内和scss样式文件处使用定义的全局scss变量而无需引入

配置方式

  1. // vite.config.js
  2. css: {
  3. preprocessorOptions: {
  4. //define global scss variable
  5. scss: {
  6. additionalData: `@import '@/styles/variables.scss';`,
  7. },
  8. }
  9. }

Naive UI主题调整

Naive UI提供了调整主题变量的选择,可以通过设定 n-config-provider 的 theme-overrides 来调整主题变量,具体方式可以参考Naive UI文档,此项目已经集成处理了,只需要修改src/store/modules/app.js文件的配置即可生效

  1. import { defineStore } from 'pinia'
  2. export const useAppStore = defineStore('app', {
  3. state() {
  4. return {
  5. themeOverrides: {
  6. common: {
  7. primaryColor: '#316c72',
  8. primaryColorSuppl: '#316c72',
  9. primaryColorHover: '#316c72',
  10. successColorHover: '#316c72',
  11. successColorSuppl: '#316c72',
  12. },
  13. },
  14. }
  15. },
  16. })