[Vue warn]:渲染错误:“ReferenceError:文件未定义”[Vuetify + NuxtJS]

And*_*ndy 2 vue.js nuxt.js vuetify.js

(我正在使用 Vuetify 和 NuxtJS)

当我尝试实现该组件时出现此错误:v-file-input

错误截图

文件.vue:

<template>
    <v-file-input
        counter
        multiple
        show-size
        truncate-length="15"
    ></v-file-input>
</template>
Run Code Online (Sandbox Code Playgroud)

我只是在这个文件中遇到这个问题,而不是在其他文件中。

当我将项目中的一些其他代码复制粘贴到此文件中时,如果我不修改它,它就会起作用。

知道为什么会这样吗?

Pie*_*aid 5

这是因为v-file-input仅使用浏览器 API。

你可以告诉 nuxt 渲染这个唯一的客户端client-only

<client-only>
  <v-file-input
    counter
    multiple
    show-size
    truncate-length="15"
  ></v-file-input>
</client-only>
Run Code Online (Sandbox Code Playgroud)

https://nuxtjs.org/docs/features/nuxt-components/#the-client-only-component