"TypeError: Cannot read property 'loadFromJSON' of undefined"
See original GitHub issueHi All,
I am saving the drawn item to local storage and rendering the canvas of the html page when the page is reloaded.
`
saveDrawing () {
var serializedData = window.drawer.api.getCanvasAsJSON();
var res = JSON.stringify(serializedData)
if (res) localStorage.setItem(‘canvas’, res)
},
loadDrawing () {
var parseData = JSON.parse(localStorage.getItem('canvas'))
window.drawer.api.loadCanvasFromData(parseData)
}
` I get the exceptions saying TypeError: Cannot read property ‘loadFromJSON’ of undefined at DrawerConstructor.Drawer.loadCanvas (drawerJs.standalone.js:29762) at DrawerApi.loadCanvasFromData (drawerJs.standalone.js:27517) at VueComponent.loadDrawing (DrawTool.vue?fd05:304) at VueComponent.mounted (DrawTool.vue?fd05:248) at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854) at callHook (vue.runtime.esm.js?2b0e:4213) at Object.insert (vue.runtime.esm.js?2b0e:3139) at invokeInsertHook (vue.runtime.esm.js?2b0e:6340) at Vue.patch [as patch] (vue.runtime.esm.js?2b0e:6559) at Vue._update (vue.runtime.esm.js?2b0e:3939)
How to fix this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
I am getting the same error when loading the data that way it seems that you have to start the editing before you can load the data that way…
it works if I write the loading that way:
Hi Naveen, did you ever figure this out?? I’m encountering the same issue