I'm in the process of developing a no-code application with Vue. I have come across an issue where I cannot add functions to a JSON file that I want to import at runtime. As a workaround, I decided to use a JavaScript or TypeScript file to store the JSON object like so:
export {
"is": "button",
"props": {
"type": "button"
},
"events": {
"click": () => {
// do something
}
}
}
Currently, my aim is to trigger the import when Vue creates the component.
{
created () {
// code to import here
}
}
I've experimented with two methods:
- Adding a script tag, but I need a way to store it first, like using window
- Using import, which only supports local files
As of now, I store these files on the backend and load them as needed on the frontend. Is there a more efficient solution available? Any help would be greatly appreciated. Thank you!