[QUESTIONS] Custom Component disappear on Save (Vue.js)
See original GitHub issueHi All,
I’m trying to test adding some custom Vue.js components to the block manager, and at first appearance, all is well - it renders correctly and vue components are responsive.
But if I save the template, and reload my page, and supply the storageManager with ‘gjs-style’, ‘gjs-components’, ‘gjs-html’, ‘gjs-css’.
The custom component no longer renders. It appears the the storageManager removes any script tags??? As if I check my REST GET request, ‘gjs-html’ does contain the <script> tag.
Before Saving:
After Reloading Loading:
Not too sure something is wrong with my component:
`
editor.BlockManager.add(“vueApp”, {
label: “Vue App”,
category: ‘Basic’,
id: “default-vue-app”,
content: {
script: function() {
const app1El = document.createElement("div");
app1El.id = 'app';
const app1Script = document.createElement("script");
app1Script.type = "text/javascript";
app1Script.src = "http://[::1]/assets/vue/vueApp.js";
this.appendChild(app1El);
this.appendChild(app1Script);
},
traits: [
{
type: 'text',
label: 'Nice',
name: 'custom_att',
value: 'Who knows',
}
]
}
});
`
Have anyone tried using Vue.js components?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (1 by maintainers)
@pouyamiralayi
Thanks for that, pointed me in the right direction - so he is an example that works for me for rending a Vue Component and it will load back in 😃, but sure may be useful for someone else:
Thanks for the help everyone!
@adamwpe we had something like this in the past i apologize for not seeing it through! go like this:
there is no need to extend from dView & dModel in the latest versions. and for the vue js integration please notice that the internal structure of your vue component would not be detected by grapesjs because there is no model generated for it! if you had any chance to overcome this scenario please let us know! Cheers!