用戶可以在我的網(wǎng)站上繪制上載的圖像。我添加了一個(gè)按鈕來完全清除畫布,但是問題是,如果用戶想再次在該圖像上繪畫,他們將無法進(jìn)行操作,因?yàn)樯蟼靼粹o仍然認(rèn)為它在那里。看到:https : //imgur.com/a/kfcZ4KO我在畫布上使用vue和面料這是我所擁有的 <b-field position="is-centered" class="file"> <b-upload required accept="image/*" v-model="filename"> <a class="button is-primary"> <b-icon icon="upload"></b-icon> <span>Click to upload</span> </a> </b-upload> <span class="file-name" v-if="filename">{{ displayFileName }}</span> <a class="button is-primary" v-on:click="clearArtboard"> <span>Clear</span> </a>我的透明canvas方法只有這個(gè)。(我認(rèn)為我需要在這里添加一些內(nèi)容?) clearArtboard() { var canvas = this.__canvas; canvas.clear(); },文件上傳時(shí)觸發(fā) async filename(file) { this.$Progress.start(); const data = new FormData(); data.append("file", file); data.append("upload_preset", ""); const res = await fetch( "https://api.cloudinary.com/v1_1//image/upload", { method: "POST", body: data } ); const uploadedFile = await res.json();所以我該怎么做,所以當(dāng)我按清除鍵時(shí),上傳按鈕會(huì)認(rèn)為沒有文件上傳?謝謝
按下按鈕后如何重置上傳的文件
函數(shù)式編程
2021-05-06 09:09:30