我使用 Vuetify.js 作為 Nuxt.Js 的 UI 框架。我想在輸入文件我的應用程序時獲取文件對象。所以我在 Vuetify.Js 中使用了 v-file-input 組件,并編寫了如下代碼。 <template> <div> <v-file-input label="fileinput" multiple v-model="files" @change="getFileObject()"></v-file-input> </div> </template><script>import { Component, Vue } from 'nuxt-property-decorator'@Component({})export default class extends Vue{ files:any = [] fileObj:any = {} async getFileObject(file:any){ this.fileObj = await file console.log(this.fileObj) }}</script>我使用 console.log 檢查了文件對象。但“this.fileObj”未定義。輸入文件時如何獲取文件對象?有人能給我建議嗎?
如何在 Nuxt.js 中使用 v-file-input 獲取文件對象?
繁星點點滴滴
2023-10-20 10:29:21