vue+富文本插件


<template>
  <div style="line-height: normal">
    <vue-ueditor-wrap v-model="msg.html" :config="myConfig" />
  </div>
</template>
<script>
import VueUeditorWrap from 'vue-ueditor-wrap'

export default {
  name: 'Noticeedit',
  components: {
    VueUeditorWrap
  },
  props: ['msg'],
  data() {
    return {
      myConfig: {
        // 編輯器不自動被內容撐高
        autoHeightEnabled: false,
        // 初始容器高度
        initialFrameHeight: 300,
        // 初始容器寬度
        initialFrameWidth: '100%',
        // 上傳文件接口(這個地址是我為了方便各位體驗文件上傳功能搭建的臨時接口,請勿在生產環境使用!!!)
        // serverUrl: 'http://35.201.165.105:8000/controller.php',
        // UEditor 資源文件的存放路徑,如果你使用的是 vue-cli 生成的項目,通常不需要設置該選項,vue-ueditor-wrap 會自動處理常見的情況,如果需要特殊配置,參考下方的常見問題2
        UEDITOR_HOME_URL: '/UEditor/',
        toolbars: [[
          'fullscreen', 'source', '|', 'undo', 'redo', '|',
          'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
          'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
          'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
          'directionalityltr', 'directionalityrtl', 'indent', '|',
          'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify'
        ]]
      }
    }
  }
}
</script>

備注:

  * 加載ueditor.config.js失敗,請檢查您的配置地址UEDITOR_HOME_URL填寫是否正確! 

    官網:https://github.com/haochuan9421/vue-ueditor-wrap

    quick start的第一步解決此問題


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM