Vue to do an upload profile picture, can you clear the file in input?

<div class="upload">
    //  
    <div class="show" v-bind:class="{showpic: is_show_pic}">
        //  src  vue data 
        <img style="text-align:center" :src="src" width="100px">
        <span class="delete-pic" @click="delete_pic">x</span>
    </div>
    
    // inputlabel
    <input @change="show_pic" type="file" id="file" class="inputfile" accept="image/png, image/jpeg, image/jpg" />

    //  label
    <label :class="{hide: isHide}" for="file" class="file-label"></label>
</div>
show_pic(e) {
    f = e.target.files[0]
    var reads= new FileReader();
    reads.readAsDataURL(f);

    let that = this
    reads.onload=function (e) {

        //  vue data  src  
        that.src=this.result;
        
        
    };
    this.is_show_pic = true
    this.isHide = true
},

// 
delete_pic() {
    //  vue data 
    // show_pic
    // inputfile
    // 
    // 
    this.src = ""
},
Mar.03,2021

input.value =''


file type is read-only
add a form tag to the input
empty the form form content.

<form id='videoForm'>
<input @change="show_pic" type="file" id="file" class="inputfile" accept="image/png, image/jpeg, image/jpg" />
</form>


document.getElementById('videoForm')&&document.getElementById('videoForm').reset();

second type:

document.getElementById('').outerHtml = document.getElementById('').outerHtml

try input value is empty, even try form

Menu