implement signature preview

This commit is contained in:
Alex Turchyn
2023-05-24 01:22:17 +03:00
parent f1da37d1ec
commit b5b4f286cf
6 changed files with 73 additions and 19 deletions
+14 -1
View File
@@ -1,5 +1,18 @@
export default class extends HTMLElement {
setValue (value) {
this.innerHTML = value
const { fieldType } = this.dataset
if (fieldType === 'signature') {
[...this.children].forEach(e => e.remove())
const img = document.createElement('img')
img.classList.add('w-full', 'h-full', 'object-contain')
img.src = value.url
this.append(img)
} else {
this.innerHTML = value
}
}
}