I checked out the official website to install the vue-email-editor.
Here is the link for the unlayer vue-email-editor component
However, I encountered the following error:
vue.runtime.esm.js?c320:4573 [Vue warn]: Error in render: "TypeError: (0 , external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock) is not a function"
TypeError: (0 , external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock) is not a function at Proxy.EmailEditorvue_type_template_id_eb864766_scoped_true_render (vue-email-editor.common.js?8479:21986:1)
Uncaught Error: Could not find a valid element for given id or className.
Can anyone guide me on how to resolve this issue? Your help is much appreciated!
Update:
After running npm install vue-email-editor --save
In my app.vue file:
<template>
<div id="app">
<h2>unlayer</h2>
<div class="container">
<div id="bar">
<h1>Vue Email Editor (Demo)</h1>
<button v-on:click="saveDesign">Save Design</button>
<button v-on:click="exportHtml">Export HTML</button>
</div>
<EmailEditor ref="emailEditor" v-on:load="editorLoaded" />
</div>
</div>
</template>
<script>
import { EmailEditor } from 'vue-email-editor';
import sample from './data/sample.json';
export default ({
components: {
EmailEditor,
},
data() {
return {
};
},
methods: {
editorLoaded() {
// Pass your template JSON here
// this.$refs.emailEditor.editor.loadDesign({});
console.log('editorLoaded');
this.$refs.emailEditor.editor.loadDesign(sample);
},
saveDesign() {
this.$refs.emailEditor.editor.saveDesign(
(design) => {
console.log('saveDesign', design);
},
);
},
exportHtml() {
this.$refs.emailEditor.editor.exportHtml(
(data) => {
console.log('exportHtml', data);
},
);
},
},
});
</script>
<style lang="scss">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;}
</style>
Update 2:
I downgraded the installed version of vue-email-editor from @2.0.0 to @0.7.2 and the issue was resolved. However, I am unsure about what caused the problem with the latest version.