【问题标题】:vue-image-upload-resize reset image filevue-image-upload-resize 重置图片文件
【发布时间】:2019-11-13 05:37:50
【问题描述】:

我在我的 Vue 项目中使用 vue-image-upload-resize。

一切正常,除了我有两个问题

  1. 如何删除“选择文件”按钮附近的文字?

  1. 文件上传后如何重置控件?基本上,当我尝试再次上传相同的文件时,它不会调用 setImage 事件。我不想在这里使用 JQuery

【问题讨论】:

    标签: javascript vue.js


    【解决方案1】:

    1。 HTML:

    <div class="input">
        <image-uploader></image-uploader>
    </div>
    

    CSS:

    .input {
        position: absolute;
        top: 0;
        left: 0;
        opacity: 0;
    }
    
    1. 您可以使用$refs

    HTML:

    <div class="input" @click="initiate">
        <image-uploader ref="image"></image-uploader>
    </div>
    

    JavaScript:

    methods: {
        initiate() { this.$refs.image.$el.children[1].value = "" }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-12
      • 2016-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-11
      • 1970-01-01
      相关资源
      最近更新 更多