add useEditor to docs

This commit is contained in:
Philipp Kühn
2021-03-05 10:29:19 +01:00
parent 81a69ef526
commit a073d75dff

View File

@@ -75,6 +75,34 @@ export default {
</script> </script>
``` ```
Alternatively, you can use the Composition API with the `useEditor` method.
```html
<template>
<editor-content :editor="editor" />
</template>
<script>
import { useEditor, EditorContent } from '@tiptap/vue-3'
import { defaultExtensions } from '@tiptap/starter-kit'
export default {
components: {
EditorContent,
},
setup() {
const editor = useEditor({
content: '<p>Im running tiptap with Vue.js. 🎉</p>',
extensions: defaultExtensions(),
})
return { editor }
},
}
</script>
```
## 4. Add it to your app ## 4. Add it to your app
Now, lets replace the content of `src/App.vue` with the following example code to use our new `Tiptap` component in our app. Now, lets replace the content of `src/App.vue` with the following example code to use our new `Tiptap` component in our app.