惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - 拼博之路

使用FreeSql时,Set JsonMap列时需要注意的事项 近日,网站 CDN 流量受到来自电信[山东烟台]、[江苏扬州]、[湖南岳阳]家庭宽带的攻击 宝塔 nginx 负载均衡配置 vs2022 编译报错System.InvalidOperationException: No file exists for the asset at either location 如何在 Nuxt3 中更改生产环境端口 .Net Core 页面Tag Helpers不提示,颜色也没有变化 net core中使用jwt时,提示DenyAnonymousAuthorizationRequirement: Requires an authenticated user [Qt] vs 2022写qt解决"常量中有换行符"编译报错问题! MySQL导入SQL文件过大或连接超时的解决办法 windows10 命令行 重置文件夹权限 .Net Core WebAPI 序列化时忽略空值字段 .net mvc中禁用客户端验证 c#8.0+ 运算符 windows11 升级到10.0.22598.200时安装到35%提示硬件尚未准备好 解决 ASP.NET Core 部署到 IIS,更新项目时"文件夹正在使用"错误 浏览器提示:你的连接不是专用连接的解决方法 HttpWebRequest 基础连接已经关闭: 连接被意外关闭 .NET Core应用程序每次启动后使用string.GetHashCode()方法获取到的哈希值(hash)不相同 elasticsearch 按分类ID查询
在Vue3中,集成VueQuill Rich Text Editor for Vue 3
拼博之路 · 2024-05-31 · via 博客园 - 拼博之路

官网地址:https://vueup.github.io/vue-quill/

github:https://github.com/vueup/vue-quill

没有中文包,胜在简单,

步骤,按官网说明安装:

npm install @vueup/vue-quill@latest --save
# OR
yarn add @vueup/vue-quill@latest

在项目的\src\components\ 路径下建立 QuillEditor.vue组件,当然,名字随意取,内容如下

<template>
    <div class="editor-box">
        <QuillEditor content-type='html' v-model:content="content" :options='editorOption' />
    </div>
</template>
<script setup lang="ts">
import { reactive, ref, watchEffect } from 'vue';
import { QuillEditor } from '@vueup/vue-quill';
import '@vueup/vue-quill/dist/vue-quill.snow.css';

const props = defineProps({
    // 默认值
    value: {
        type: String,
        default: '',
    },
});

const emit = defineEmits(['update:value']);

const content = ref(props.value);
const editorOption = reactive({
    modules: {
        toolbar: [  // 工具栏配置
            [{ 'color': [] },'bold', 'italic', 'underline', 'strike'],  // 粗体、斜体、下划线、删除线
            [{ 'header': 1 }, { 'header': 2 }],  // 标题1和标题2
            [{ 'list': 'ordered' }, { 'list': 'bullet' }],  // 有序列表和无序列表
            [{ 'script': 'sub' }, { 'script': 'super' }],  // 上标和下标
            [{ 'indent': '-1' }, { 'indent': '+1' }],  // 缩进
            [{ 'direction': 'rtl' }],  // 文字方向
            [{ 'size': ['small', false, 'large', 'huge'] }],  // 字号
            [{ 'header': [1, 2, 3, 4, 5, 6, false] }],  // 标题等级
            [{ 'color': [] }, { 'background': [] }],  // 字体颜色和背景色
            [{ 'font': [] }],  // 字体
            [{ 'align': [] }],  // 对齐方式
            ['clean']  // 清除格式
        ]
    },
    placeholder: '请输入内容...',
    theme: 'snow'
},
);
// 内容有变化,就更新内容,将值返回给父组件
watchEffect(() => {
    emit('update:value', content.value);
});
</script>

 在父组件中使用

<script setup lang="ts">
import QuillEditor from '../../components/QuillEditor.vue';
</script>
<template>
<QuillEditor v-model:value="item.content" />
</template>

已测试通过,引用的路径根据自已的项目情况自行更改


关于浏览器警告

[Deprecation] Listener added for a synchronous 'DOMNodeInserted' DOM Mutation Event. This event type is deprecated () and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.

vue-quill使用的是quill.js 1.3.7版本,存在这个警告,但作者目前又没有更新,可以使用以下的方式,强制使用quill.js2.0.2版本

更新你的 package.json,增加

 "pnpm": {
    "overrides": {
      "quill": "2.0.2"
    }
  }

清理 pnpm 缓存:

pnpm store prune
删除 node_modules 和 pnpm-lock.yaml:

rm -rf node_modules pnpm-lock.yaml
重新安装所有依赖:

pnpm install

然后刷新页面,发现警告消失了