gpt4 book ai didi

javascript - @nuxtjs/vuetify 未应用样式

转载 作者:行者123 更新时间:2023-12-03 08:23:01 26 4
gpt4 key购买 nike

我在 Nuxt 项目中使用 vuetify 时遇到问题,我按照文档说明您只需将 @nuxtjs/vuetify 依赖项安装到您的项目中,并在 中添加一行nuxt.config.js 文件的 >buildModules 部分。这些组件工作正常,但我在它们上看不到任何 css 样式,出了什么问题?

nuxt vuetify no css

这是我的 nuxt.config.js 文件

   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: {},
}

最佳答案

您应该在 nuxt.config.js 文件中添加 vuetify 主题信息以及 axiosbuild。像这样..

  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,
},
},
},
},

如果您不清楚,请问我。

关于javascript - @nuxtjs/vuetify 未应用样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67298040/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com