yarn add tinymce

dependencies:{}
“@tinymce/tinymce-vue”: “3.2.8”,

  1. "@tinymce/tinymce-vue": "1.1.0",

企业微信截图_16225351816642.png

使用

  1. <editor :init="editorInit" v-model="goods.detail"/>
  2. import Editor from '@tinymce/tinymce-vue'
  3. export default {
  4. name: 'GoodsCreate',
  5. components: { Editor },
  6. data(){
  7. return {
  8. editorInit: {
  9. language: 'zh_CN',
  10. convert_urls: false,
  11. plugins: ['advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools importcss insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'],
  12. toolbar: ['searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen'],
  13. images_upload_handler: function(blobInfo, success, failure) {
  14. const formData = new FormData()
  15. formData.append('file', blobInfo.blob())
  16. createStorage(formData).then(res => {
  17. success(res.data.data.url)
  18. }).catch(() => {
  19. failure('上传失败,请重新上传')
  20. })
  21. }
  22. }
  23. }
  24. }