国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

vue使用富文本編輯器 Wangeditor 可顯示編輯新增回顯禁用

這篇具有很好參考價值的文章主要介紹了vue使用富文本編輯器 Wangeditor 可顯示編輯新增回顯禁用。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

1.效果圖

vue使用富文本編輯器 Wangeditor 可顯示編輯新增回顯禁用,vue,組件,vue.js,javascript

?2.安裝依賴

npm install wangeditor

?3.在main.js 全局引入 富文本組件

import editorBar from "@/components/editor/editor.vue";
Vue.component('editorBar', editorBar)?

全局引入頁面使用?

<editor-bar v-model="form.nr" :flag="false" @change="getcontent" />

mothods:{

? ? ?//獲取富文本內(nèi)容

? ? getcontent (content) {

? ? ? ?this.form.nr = content;

? ? },

}

或者直接在組件中使用

<editor-bar v-model="form.nr" :flag="false" @change="getcontent" />

import EditorBar from "@/components/editor/editor";?

components: {

? ? EditorBar,

? },

mothods:{

? ? ?//獲取富文本內(nèi)容

? ? getcontent (content) {

? ? ? ?this.form.nr = content;

? ? },

}

4.封裝富文本文件? ?在src公共文件下新建一個命名為editor.vue的文件

詳情可參考:富文本編輯器安裝使用_editor-bar_可不&可以的博客-CSDN博客

?

<template>
? <div id="wangeditor" class="editor">
? ? <div ref="toolbar" class="toolbar"></div>
? ? <div ref="editor" class="text"></div>
? </div>
</template>

<script>
import E from 'wangeditor'
import {
? uploadPictures
} from '@/api/user'
export default {
? model: {
? ? prop: 'value',
? ? event: 'change',
? },
? props: {
? ? value: {
? ? ? type: String,
? ? ? required: true,
? ? },

? ? //是否禁用
? ? flag: {
? ? ? type: Boolean,
? ? ? required: true,
? ? },
? },
? data () {
? ? return {
? ? ? editor: null,
? ? ? info_: null,
? ? ? tableHeight: '600px',
? ? ? uploadurl: process.env.VUE_APP_BASE_API + '/cs/localStorage/pictures',
? ? }
? },

? watch: {
? ? value (newval) {
? ? ? if (newval !== this.editor.txt.html()) {
? ? ? ? this.editor.txt.html(newval)
? ? ? }
? ? },
? ? flag: {
? ? ? immediate: true,
? ? ? handler: function (newval) {
? ? ? ? this.$nextTick(() => {
? ? ? ? ? this.editor.$textElem.attr('contenteditable', newval)
? ? ? ? })
? ? ? },
? ? ? deep: true,
? ? },
? },
? mounted () {
? ? //初始化富文本編輯器
? ? this.seteditor();
? ? // 這一步非常重要,用于富文本修改信息的時候,數(shù)據(jù)回顯
? ? // this.value是父子傳參,動態(tài)傳值的
? ? this.editor.txt.html(this.value);

? },
? methods: {
? ? seteditor () {
? ? ? let that = this
? ? ? that.editor = new E(that.$refs.toolbar, that.$refs.editor)
? ? ? that.editor.customConfig.uploadImgShowBase64 = false
? ? ? that.editor.customConfig.pasteFilterStyle = true

? ? ? // 配置菜單
? ? ? that.editor.customConfig.menus = [
? ? ? ? 'head', // 標(biāo)題
? ? ? ? 'bold', // 粗體
? ? ? ? 'fontSize', // 字號
? ? ? ? 'fontName', // 字體
? ? ? ? 'italic', // 斜體
? ? ? ? 'underline', // 下劃線
? ? ? ? 'strikeThrough', // 刪除線
? ? ? ? 'foreColor', // 文字顏色
? ? ? ? 'backColor', // 背景顏色
? ? ? ? 'link', // 插入鏈接
? ? ? ? 'list', // 列表
? ? ? ? 'justify', // 對齊方式
? ? ? ? 'quote', // 引用
? ? ? ? // 'emoticon', // 表情
? ? ? ? 'image', // 插入圖片
? ? ? ? 'table', // 表格
? ? ? ? // 'video', // 插入視頻
? ? ? ? // 'code', // 插入代碼
? ? ? ? 'undo', // 撤銷
? ? ? ? 'redo', // 重復(fù)
? ? ? ? // 'fullscreen', // 全屏
? ? ? ]
? ? ? that.editor.customConfig.onchange = (html) => {
? ? ? ? that.info_ = html // 綁定當(dāng)前逐漸地值
? ? ? ? that.$emit('change', that.info_) // 將內(nèi)容同步到父組件中
? ? ? }
? ? ? // 字號
? ? ? // console.log(this.editor)
? ? ? that.editor.customConfig.uploadImgServer = that.uploadurl
? ? ? that.editor.customConfig.uploadFileName = 'file'

? ? ? //自定義圖片上傳
? ? ? that.editor.customConfig.customUploadImg = function (files, insert) {
? ? ? ? // file是是input中選中的文件列表?
? ? ? ? // ?insert是獲取圖片url后,插入到編輯器中的方法
? ? ? ? var formData = new FormData();
? ? ? ? var obj = {};
? ? ? ? for (var i = 0; i < files.length; i++) {
? ? ? ? ? obj = files[i]
? ? ? ? }
? ? ? ? //后端所需的參數(shù)
? ? ? ? formData.append('file', obj);
? ? ? ? uploadPictures(formData).then(result => {
? ? ? ? ? let url = 'http://192.168.2.40:8080/cs/file/' + result.type + '/' + result.realName
? ? ? ? ? insert(url);
? ? ? ? })
? ? ? };
? ? ? // 創(chuàng)建富文本編輯器
? ? ? that.editor.create()
? ? }
? }
}
</script>

<style lang="scss" scoped>
.editor {
? width: 100%;
? margin: 0 auto;
? position: relative;
? z-index: 0;
}

::v-deep table {
? border-collapse: collapse;
}

.toolbar {
? border: 1px solid #ccc;
}

.text {
? border: 1px solid #ccc;
}

::v-deep .w-e-text-container {
? height: 500px !important;
}

::v-deep #wangeditor {
? .w-e-text-container {
? ? z-index: 1 !important;
? ? // table {
? ? // margin-left: 0 !important;
? ? // }
? }

? .w-e-toolbar {
? ? flex-wrap: wrap;
? }

? .w-e-menu {
? ? z-index: auto !important;

? ? .w-e-droplist {
? ? ? z-index: 2 !important;
? ? }
? }
}
</style>
?文章來源地址http://www.zghlxwxcb.cn/news/detail-537682.html

到了這里,關(guān)于vue使用富文本編輯器 Wangeditor 可顯示編輯新增回顯禁用的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • VUE2整合富文本編輯器 wangEditor

    2024年02月20日
    瀏覽(35)
  • vue2+wangEditor5富文本編輯器

    vue2+wangEditor5富文本編輯器

    1、安裝使用 安裝 yarn add @wangeditor/editor # 或者 npm install @wangeditor/editor --save yarn add @wangeditor/editor-for-vue # 或者 npm install @wangeditor/editor-for-vue --save ?在main.js中引入樣式 import \\\'@wangeditor/editor/dist/css/style.css\\\' ? 在使用編輯器的頁面引入js? import { Editor, Toolbar } from \\\"@wangeditor/editor-fo

    2024年01月22日
    瀏覽(20)
  • React----富文本編輯器wangEditor的使用

    wangEditor 5 —— 輕量級 web 富文本編輯器,配置方便,使用簡單。支持 IE10+ 瀏覽器。 官網(wǎng):www.wangEditor.com 注意: wangeditor都是小寫字母 Editor : 編輯器組件 Toolbar: 菜單欄組件 實例化編輯器 工具欄配置決定了在工具欄顯示哪些工具,菜單配置決定了該工具使用時的相關(guān)配置。

    2024年01月21日
    瀏覽(30)
  • HTML——實現(xiàn)富文本編輯器wangEditor的使用

    HTML——實現(xiàn)富文本編輯器wangEditor的使用

    背景:最近在寫小說項目,關(guān)于發(fā)布文章需要用到富文本編輯器,由于還沒學(xué)到Vue,最實用的還是用wangEditor富文本編輯器。 官方文檔:http://www.wangeditor.com/ 使用手冊:創(chuàng)建一個編輯器 · wangEditor3使用手冊 · 看云 (kancloud.cn) 至于實現(xiàn)的方式有三種: 一.導(dǎo)入wangEditor.JS 使用方法

    2024年02月11日
    瀏覽(38)
  • vue2+wangEditor5富文本編輯器(圖片視頻上傳)并加錨鏈接

    vue2+wangEditor5富文本編輯器(圖片視頻上傳)并加錨鏈接

    官網(wǎng):https://www.wangeditor.com/v5/installation.html#npm 1、安裝使用 安裝 在main.js中引入樣式 在使用編輯器的頁面引入js 模板 js 到這一步編輯完就可以正常顯示了 2、上傳圖片、視頻 1)上傳到后臺接口的可直接按照文檔這個配置就行接口返回格式也要可文檔上一致 2)自定義上傳(一

    2024年02月12日
    瀏覽(93)
  • vue2+wangEditor5富文本編輯器(圖片視頻自定義上傳七牛云/服務(wù)器)

    vue2+wangEditor5富文本編輯器(圖片視頻自定義上傳七牛云/服務(wù)器)

    1、安裝使用 安裝 在main.js中引入樣式 在使用編輯器的頁面引入js 模板 js ?到這一步編輯器就可以正常顯示了 2、上傳圖片、視頻 上傳到后臺接口的可直接按照文檔這個配置就行接口返回格式也要可文檔上一致 ? ?2)自定義上傳(一般上傳到別的服務(wù)器上,我這邊是上傳到七

    2024年02月11日
    瀏覽(105)
  • Vue中使用 WangEditor 編輯器的詳細(xì)教程

    WangEditor 是一個基于 JavaScript 的富文本編輯器,提供了豐富的編輯功能和靈活的定制能力。以下是 WangEditor 的一些優(yōu)點: 易于集成和使用 :WangEditor 提供了清晰的 API 和文檔,易于集成到各種前端項目中,無論是基于 Vue、React 還是其他框架。 功能豐富 :WangEditor 提供了豐富的

    2024年02月07日
    瀏覽(45)
  • wangEditor富文本編輯器圖片/視頻上傳

    wangEditor富文本編輯器圖片/視頻上傳

    wangEditor 有豐富的 API 和足夠的擴(kuò)展性,允許我們自定義開發(fā)菜單、模塊、插件等。在 Vue、React 中運用也很方便。因此本文介紹下vue中富文本上傳圖片和視頻。 安裝引入后富文本有顯示上傳圖片按鈕,點擊上傳后會報 沒有配置上傳地址 的錯誤,如下圖所示: 所以自定義上傳

    2024年02月15日
    瀏覽(95)
  • Vue3項目中使用富文本編輯器

    tinymce簡介 一、 安裝 二、使用步驟 1. 封裝組件 2. 組件中掛載 3.應(yīng)用富文本 總結(jié) TinyMCE 是一款易用、且功能強(qiáng)大的所見即所得的富文本編輯器。跟其他富文本編輯器相比,有著豐富的插件,支持多種語言,能夠滿足日常的業(yè)務(wù)需求并且免費。 一、安裝Tinymce 注意:版本可根據(jù)

    2024年02月15日
    瀏覽(30)
  • vue使用富文本編輯器vue-quill-editor

    vue使用富文本編輯器vue-quill-editor

    問題描述: 我們在開發(fā)過程中經(jīng)常會遇到使用富文本編輯器進(jìn)行操作,當(dāng)前插件市場上關(guān)于富文本的編輯器挺多的,我們就不一一個介紹了,現(xiàn)在我們主要講解一些vue-quill-editor富文本編輯器的使用操作和注意事項。 效果圖 具體操作使用 1. 安裝 2. 引入到項目中 有兩種掛載方

    2024年02月02日
    瀏覽(33)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包