【发布时间】:2020-05-23 14:54:05
【问题描述】:
我已经使用“npx create-nuxt-app”命令创建了一个 Nuxt 应用程序,如 Nuxt 文档中所述,选择 Vuetify 作为选项之一。这将创建一个默认的 Nuxt 应用程序,该应用程序在 webpack 开发模式下与 Vuetify 完美运行。但是,当我添加
buildDir: './../functions/nuxt'
到 Nuxt 配置并运行 'yarn dev' Vuetify 会损坏,并且每当 Vue 到达 Vuetify 并且页面变为空白时,页面的渲染就会停止。
这些是浏览器给出的主要错误
- [Vuetify] 检测到多个 Vue 实例
- [Vue 警告]:beforeCreate 挂钩中的错误:“错误:Vuetify 未正确初始化
这里是 nuxt.config.js
import colors from 'vuetify/es5/util/colors'
export default {
mode: 'universal',
head: {
title: 'Frame of Nuxt2 application on Firebase',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto' }
]
},
loading: { color: '#fff' },
css: [
],
plugins: [
],
buildModules: [
'@nuxtjs/eslint-module',
'@nuxtjs/vuetify'
],
modules: [
'@nuxtjs/axios',
'@nuxtjs/pwa'
],
axios: {
},
vuetify: {
customVariables: ['~/assets/variables.scss'],
theme: {
dark: 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
}
}
}
},
buildDir: './../functions/nuxt',
build: {
extend (config, ctx) {
}
}
}
我似乎对 Vuetify 如何与 Nuxt 一起工作缺乏了解,并且想不出为什么不以默认方式构建应用程序(默认情况下它在 .nuxt 文件夹中的项目内构建它)破坏它的可能原因。
非常感谢任何见解
【问题讨论】:
标签: vue.js vuetify.js nuxt.js