Vue.js 如何在vuetify上上载的3个文件中删除1个文件?

Vue.js 如何在vuetify上上载的3个文件中删除1个文件?,vue.js,file-upload,vue-component,vuetify.js,image-uploading,Vue.js,File Upload,Vue Component,Vuetify.js,Image Uploading,我在文件上读到: 我的代码如下: <v-file-input v-model="files" placeholder="Upload your documents" label="File input" multiple prepend-icon="mdi-paperclip" > <template v-slot:selection="{ text }"> <v-chip small label

我在文件上读到:

我的代码如下:

<v-file-input
  v-model="files"
  placeholder="Upload your documents"
  label="File input"
  multiple
  prepend-icon="mdi-paperclip"
>
  <template v-slot:selection="{ text }">
    <v-chip
      small
      label
      color="primary"
    >
      {{ text }}
    </v-chip>
  </template>
</v-file-input>

{{text}}
我的密码笔:

上传3张图片并删除时,会删除所有图片。我希望用户能够删除1个图像根据他的选择。因此,用户可以删除1张图片


如何执行此操作?

使用处理程序方法配置要删除的芯片

  • 将“关闭”属性添加到
    v-chip
    以获得每个文件上的关闭按钮

  • 向芯片添加一个处理程序,传递索引(如果需要提示,还传递文本)

  • (可选)删除VFileInput上的“全部清除”按钮,以防止用户混淆

模板


{{text}}
组件

newvue({
el:“#应用程序”,
vuetify:新的vuetify(),
数据:()=>({
文件:[],
}),
方法:{
删除芯片(索引,文本){
//如果需要,在此处提示文字
this.files.splice(索引,1)
},
}
})

感谢您提出的解决方案。工作起来很有魅力。