[Vue warn]: Error in render: "ReferenceError: File is not defined" [Vuetify + NuxtJS]
[Vue warn]: Error in render: "ReferenceError: File is not defined" [Vuetify + NuxtJS]
(我正在使用 Vuetify 和 NuxtJS)
我在尝试实现组件时遇到此错误:v-file-input
file.vue :
<template>
<v-file-input
counter
multiple
show-size
truncate-length="15"
></v-file-input>
</template>
我只是在这个文件中有这个问题,在其他文件中没有。
当我从我的项目中复制粘贴一些其他代码到这个文件中时,如果我不修改它,它就可以工作。
知道为什么会这样吗?
这是因为v-file-input
只使用浏览器API。
你可以告诉 nuxt 使用 client-only
渲染这个唯一的客户端
<client-only>
<v-file-input
counter
multiple
show-size
truncate-length="15"
></v-file-input>
</client-only>
https://nuxtjs.org/docs/features/nuxt-components/#the-client-only-component
(我正在使用 Vuetify 和 NuxtJS)
我在尝试实现组件时遇到此错误:v-file-input
file.vue :
<template>
<v-file-input
counter
multiple
show-size
truncate-length="15"
></v-file-input>
</template>
我只是在这个文件中有这个问题,在其他文件中没有。
当我从我的项目中复制粘贴一些其他代码到这个文件中时,如果我不修改它,它就可以工作。
知道为什么会这样吗?
这是因为v-file-input
只使用浏览器API。
你可以告诉 nuxt 使用 client-only
<client-only>
<v-file-input
counter
multiple
show-size
truncate-length="15"
></v-file-input>
</client-only>
https://nuxtjs.org/docs/features/nuxt-components/#the-client-only-component