vue 富文本插件_前端富文本编辑器插件

vue 富文本插件_前端富文本编辑器插件1.引用quill<scriptsrc="/lib/quill/quill.min.js"></script><linkhref="/lib/quill/quill.snow.css"rel="stylesheet"/>2.RichEditorDemo.vue<template><divcl

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

1.引用quill

<script src="/lib/quill/quill.min.js"></script>
<link href="/lib/quill/quill.snow.css" rel="stylesheet" />

2.RichEditorDemo.vue

<template>
  <div class="yh-page">
    <h1>富文本编辑器演示</h1>
    <div class="desc">Demo源代码:
      <code>/examples/components/modules/RichEditorDemo.vue</code>
    </div>
    <div class="yh-block">
      <el-row>
        <el-col :span="13">
          <div id="editor" style="height:300px"></div>
          <div style="margin-top:15px;text-align:center">
            <yh-button @click="onSave">保存</yh-button>
          </div>
        </el-col>
        <el-col :span="11">
          <div id="re-content" style="background-color:#fefefe;height:300px;width:100%;padding:8px"></div>
        </el-col>
      </el-row>
    </div>
    <div class="yh-desc yh-block">
      <h2>引用quill</h2>
      <pre>&lt;script src=&quot;/lib/quill/quill.min.js&quot;&gt;&lt;/script&gt;
&lt;link href=&quot;/lib/quill/quill.snow.css&quot; rel=&quot;stylesheet&quot; /&gt;</pre>
    </div>
  </div>
</template>
<script>
import yhbutton from "../comcompont/Button";
export default {
  name: "RichEditorDemo",
  data() {
    return {};
  },
  methods: {
    onSave() {
      var delta = this.$quill.getContents();
      console.log("delta " + JSON.stringify(delta));
      var html = this.$quill.root.innerHTML;
      $("#re-content").html(html);
    }
  },
  mounted() {
    var quill = new Quill("#editor", {
      modules: {
        toolbar: [
          [{ header: [1, 2, false] }],
          ["bold", "italic", "underline"],
          [{ color: [] }, { background: [] }],
          [{ font: [] }],
          [{ align: [] }],
          ["image", "link"]
        ]
      },
      theme: "snow"
    });
    this.$quill = quill;
  },
  components: {
    "yh-button": yhbutton,
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scope>
</style>

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/182100.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号