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

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
Jina AI
Jina AI
雷峰网
雷峰网
月光博客
月光博客
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
B
Blog RSS Feed
美团技术团队
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
Security Latest
Security Latest
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
Last Week in AI
Last Week in AI
A
Arctic Wolf
Latest news
Latest news
Attack and Defense Labs
Attack and Defense Labs
I
Intezer
F
Fortinet All Blogs
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog
S
Secure Thoughts
Help Net Security
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
V
Visual Studio Blog
P
Proofpoint News Feed
博客园 - 【当耐特】
P
Privacy International News Feed
V
Vulnerabilities – Threatpost
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
云风的 BLOG
云风的 BLOG
Hacker News: Ask HN
Hacker News: Ask HN
L
LINUX DO - 最新话题
H
Help Net Security
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tenable Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog

博客园 - 拼博之路

使用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

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