반응형
1. 설치
npm install jodit-vue --save
2. main.js에 코드추가 (플러그인 연결)
import 'jodit/build/jodit.min.css'
import Vue from 'vue'
import JoditVue from 'jodit-vue'
Vue.use(JoditVue)
3. 원하는 template에 코드 추가
<template>
<div id="app">
<jodit-edirot v-model="contents" :buttons="buttons" :conffig="config" />
</div>
</template>
<script>
import 'jodit/build/jodit.min.css'
import { JoditEditor } from 'jodit-vue'
export default {
name: 'app',
components: { JoditEditor },
data(){
return{
/* 사용하고 싶은 버튼만 넣어서 사용할 수 있음 */
buttons : ['bold', 'underline', strikethrough', 'eraser',
'|', 'left', 'center', 'right',
'|', 'brush', 'fontsize', 'paragraph', 'lineHeight', 'hr',
'|', 'image', 'print',
'|', 'undo', 'redo',
'|', 'find', 'preview'],
/* 이미지 업로드 기능 추가 하려면 config에 uploader 추가 */
config :{
uploader : { insertImageAsBase64URL : true},
placeholder : '',
}
}
}
</script>
<style>
</style>
4. 결과
이렇게 잘 보인다. width에 따라 메뉴바가 변경되니 참고할 것. 아래 에디터는 width가 줄어든 모습이다.
https://ddolcat.tistory.com/2112
[Vue.js + Vuetify.js] Jodit 에디터 파일 업로드 기능 구현시 함수 또는 스크립트(method) 호출시 is not a fu
Jodit 에디터 사용시 서버로 파일 업로드 기능을 사용하려면 별도의 추가 작업을 해야한다. 파일 업로드시 formdata 형식으로 서버로 전달담으로 vue에서 파일업로드시 axios에서 formdata를 파라미터로
ddolcat.tistory.com
https://www.npmjs.com/package/jodit-vue
jodit-vue
Vue wrapper for Jodit Editor. Latest version: 2.6.0, last published: 7 months ago. Start using jodit-vue in your project by running `npm i jodit-vue`. There are 4 other projects in the npm registry using jodit-vue.
www.npmjs.com
반응형
'실무 > vue.js 실무 기능' 카테고리의 다른 글
9. [vue-js-modal] Modal | vue.js 모달 드래그 (0) | 2023.01.01 |
---|---|
8. vue.js | window.open() 으로 Popup 만들기 (0) | 2022.11.22 |
6. vue.js | @clikc=""시 뒤로가기, 앞으로가기, main 이동 (0) | 2022.10.31 |
5. vue.js | SearchBar 자동완성 기능_코드, 클릭시 링크 이동 (0) | 2022.09.29 |
4. vue.js SearchBar 자동완성_참고 포스팅 모음 (0) | 2022.09.29 |