Apr 24, 2022
0
Level 3
Load signature to vue-signature-pad from php base64
Hi, I am beginner in vue and js. I make my project in Vue 2 and Laravel
I have this code: https://pastebin.com/APDLa1mM
I try load data from php here:
async mounted() {
let self = this;
fetch(
this.$apiAdress + '/api/tasks/getTaskSignature/' + self.$route.params.id + '?token=' + localStorage.getItem("api_token")
)
.then((raw) => raw.blob())
.then((blob) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = () => { console.log(reader.result);
this.$refs.signaturePad.fromDataURL(reader.result);
};
});
},
In result I have this string from php: https://pastebin.com/rxj5wB6e
When I run my page I have error:
[Vue warn]: Error in mounted hook: "ReferenceError: Can't find variable: regeneratorRuntime"
found in
---> <EditTask> at src/views/task/EditTask.vue
<Anonymous>
<CWrapper>
<TheContainer> at src/containers/TheContainer.vue
<App> at src/App.vue
<Root>
ReferenceError: Can't find variable: regeneratorRuntime
In result I want show my signature in vue-signature-pad:
<vue-signature-pad
id="signature"
width="100%"
height="500px"
ref="signaturePad"
:options="{
onBegin: () => {$refs.signaturePad.resizeCanvas()},
}"
/>
How can I repair it?
Please help me
Please or to participate in this conversation.