Vue 3
@veditor.eu/vue is a Vue 3 component with v-model and a ready event. It is an ES module without a build step; Vue 3.2+ is a peer dependency (tested with Vue 3.5). The package contains no licence logic: pass the key in options.licenseKey as in the plain editor.
Installation
npm install @veditor.eu/vue
Where the editor comes from
The component loads the editor (its ES modules and styles) from your server, from assets-url, once per page, on first use. The default is /veditor/assets/{version}, the route of the Laravel and Symfony integrations. See React for the other cases.
Usage
<script setup>
import { ref } from 'vue';
import { VEditor } from '@veditor.eu/vue';
const props = defineProps({ article: Object, csrfToken: String });
const html = ref(props.article.body);
const onReady = (editor) => console.log(editor.getStats());
</script>
<template>
<form method="post">
<VEditor
v-model="html"
name="content"
:options="{ language: 'en', licenseKey: 'VED1.…', ai: { url: '/veditor/ai', csrfToken } }"
@ready="onReady"
/>
<button>Save</button>
</form>
</template>
| Prop / event | Description |
|---|---|
v-model (modelValue) | HTML content; external changes replace the editor content |
options | editor options, used when the editor is created |
assets-url | address of the editor files, default /veditor/assets/{version} |
name, id | attributes of the <textarea> |
@ready(editor) | the editor instance with the whole API |
The component also exposes editor() through a template ref.
options and assets-url are read when the editor is created; to apply new values, change the component's key. The package also exports loadVEditor(assetsUrl), which loads the editor module without the component, plus VERSION and DEFAULT_ASSETS_URL. TypeScript declarations are included (VEditorOptions, VEditorInstance).
Something unclear? Send feedback on the documentation.