【问题标题】:Vuetify -remove preview image after cancelling the uploadVuetify - 取消上传后删除预览图
【发布时间】:2020-11-13 22:49:55
【问题描述】:

我在取消后尝试删除图像预览,但在网上找不到答案

插入图片

取消后

vue.js

   <v-avatar
      size="95">
      <v-img :src="url" />
    </v-avatar>
  </v-flex>
  <v-flex xs8>
    <v-file-input
      v-model="image"
      accept=".png, .jpeg, .jpg"
      :rules="imagesize"
      hint="File extentions (.png, .jpg, .jpeg) File Size limits (max: 10mb)"
      placeholder="Upload profile image"
      prepend-icon="mdi-camera"
      outlined
      filled
      @change="Preview_image"/>
  </v-flex>

方法

Preview_image() {
  this.url = URL.createObjectURL(this.image);
},

【问题讨论】:

    标签: javascript vue.js vuetify.js


    【解决方案1】:

    v-file-input 组件的@click:clear 处理程序中重置url 属性:

     <v-file-input
       ...
     @click:clear="url=''"
    

    LIVE DEMO

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-25
      • 1970-01-01
      • 1970-01-01
      • 2012-04-29
      • 2021-04-23
      • 2021-02-26
      • 2017-06-14
      • 1970-01-01
      相关资源
      最近更新 更多