首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >@nuxtjs/vuetify不应用样式

@nuxtjs/vuetify不应用样式
EN

Stack Overflow用户
提问于 2021-04-28 18:01:41
回答 1查看 179关注 0票数 1

我在一个Nuxt项目中使用vuetify有一个问题,我遵循了文档,告诉你只需要在你的项目中安装@nuxtjs/vuetify依赖项,并在nuxt.config.js文件的buildModules部分添加一行。组件运行正常,但我没有看到任何css样式,有什么问题吗?

这是我的nuxt.config.js文件

代码语言:javascript
复制
   export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'mounir-ssr-diabete',
    htmlAttrs: {
      lang: 'en',
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' },
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/typescript
    '@nuxt/typescript-build',
    ['@nuxtjs/vuetify', {}],
  ],

  router: {},

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    [
      '@nuxtjs/firebase',
      {
        config: {
          apiKey: 'AIzaSyD_wgrl3S3RjpgwaEP2bDLpLDnIQz2C2Vc',
          authDomain: 'mounir-ssr.firebaseapp.com',
          projectId: 'mounir-ssr',
          storageBucket: 'mounir-ssr.appspot.com',
          messagingSenderId: '26338888590',
          appId: '1:26338888590:web:be1893a374f3abc10cb2df',
          measurementId: 'G-Y7YHDQDLM8',
        },
        services: {
          auth: {
            persistence: 'local', // default
            initialize: {
              onAuthStateChangedAction: 'onAuthStateChangedAction',
              subscribeManually: false,
            },
            ssr: false,
          },
        },
      },
    ],
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {},

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {},
}
EN

回答 1

Stack Overflow用户

发布于 2021-04-28 19:17:48

您应该将vuetify主题信息与axiosbuild一起添加到nuxt.config.js文件中。像这样..。

代码语言:javascript
复制
  buildModules: [
    // Doc: https://github.com/nuxt-community/eslint-module
    "@nuxtjs/eslint-module",
    "@nuxtjs/vuetify",
  ],
  /*
   ** Nuxt.js modules
   */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    "@nuxtjs/axios",
  ],
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {},
    
  vuetify: {
    customVariables: ["~/assets/variables.scss"],
    theme: {
      light: true,
      themes: {
        dark: {
          primary: colors.blue.darken2,
          accent: colors.grey.darken3,
          secondary: colors.amber.darken3,
          info: colors.teal.lighten1,
          warning: colors.amber.base,
          error: colors.deepOrange.accent4,
          success: colors.green.accent3,
        },
      },
    },
  },

如果你不清楚,请问我。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67298040

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档