我是vue的初學者。我有我的第一篇文章在這里。我在 Vue 2 中制作我的專案。
我有這個代碼:https ://pastebin.com/Ddaqf6E9
<vue-signature-pad
id="signature"
width="100%"
height="500px"
ref="signaturePad"
:options="{
onBegin: () => {$refs.signaturePad.resizeCanvas()},
images: () => { 'https://a.allegroimg.com/s1024/11837d/f04da35e4213a6f817918924c51f/8BitDo-ADAPTER-GRAJ-PADEM-PS4-XBOX-NA-SWITCH-PC-Sposob-podlaczenia-bezprzewodowy'}
}"
/>
這是作業正常。當我點擊 cavas - 我可以繪畫。
現在,我需要將資料庫中的簽名添加到此畫布(頁面重新加載后)。我可以在 php 中創建影像。為了測驗,我嘗試將此影像添加到畫布:https ://a.allegroimg.com/s1024/11837d/f04da35e4213a6f817918924c51f/8BitDo-ADAPTER-GRAJ-PADEM-PS4-XBOX-NA-SWITCH-PC-Sposob-podlaczenia-bezprzewodowy
但它不可見:(
我該如何修復它?
uj5u.com熱心網友回復:
看看這個演示
...
async mounted() {
fetch("https://a.allegroimg.com/s1024/11837d/f04da35e4213a6f817918924c51f/8BitDo-ADAPTER-GRAJ-PADEM-PS4-XBOX-NA-SWITCH-PC-Sposob-podlaczenia-bezprzewodowy")
.then(raw => raw.blob())
.then(blob => {
const reader = new FileReader();
reader.readAsDataURL(blob)
reader.onloadend = () => {
this.$refs.signaturePad.fromDataURL(reader.result)
}
})
}
...
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/463059.html
標籤:javascript 拉拉维尔 Vue.js
上一篇:Vue3:樹形選單顯示
