Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
Support
提交反馈
为 GitLab 提交贡献
登录
切换导航
C
competitionWeb
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
刘英杰
competitionWeb
提交
2b1d4778
提交
2b1d4778
编写于
10月 25, 2023
作者:
刘英杰
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
测试提交
上级
b9ae30a7
变更
1
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
136 行增加
和
132 行删除
+136
-132
index.vue
src/components/quill/index.vue
+136
-132
未找到文件。
src/components/quill/index.vue
浏览文件 @
2b1d4778
<
template
>
<div
class=
"i-quill"
:class=
"classes"
>
<div
ref=
"editor"
:style=
"styles"
></div>
<div></div>
</div>
</
template
>
<
script
>
import
Quill
from
'
quill
'
;
import
'
quill/dist/quill.core.css
'
;
import
'
quill/dist/quill.snow.css
'
;
import
'
quill/dist/quill.bubble.css
'
;
import
Quill
from
'
quill
'
;
import
'
quill/dist/quill.core.css
'
;
import
'
quill/dist/quill.snow.css
'
;
import
'
quill/dist/quill.bubble.css
'
;
export
default
{
export
default
{
name
:
'
i-quill
'
,
props
:
{
value
:
{
...
...
@@ -28,7 +29,7 @@
type
:
Number
}
},
data
()
{
data
()
{
return
{
Quill
:
null
,
currentValue
:
''
,
...
...
@@ -39,34 +40,34 @@
modules
:
{
toolbar
:
[
[
'
bold
'
,
'
italic
'
,
'
underline
'
,
'
strike
'
],
[{
'
header
'
:
[
1
,
2
,
3
,
4
,
5
,
6
,
false
]
}],
[{
'
size
'
:
[
'
small
'
,
false
,
'
large
'
,
'
huge
'
]
}],
[{
'
color
'
:
[]
},
{
'
background
'
:
[]
}],
[{
'
header
'
:
[
1
,
2
,
3
,
4
,
5
,
6
,
false
]
}],
[{
'
size
'
:
[
'
small
'
,
false
,
'
large
'
,
'
huge
'
]
}],
[{
'
color
'
:
[]},
{
'
background
'
:
[]
}],
[
'
blockquote
'
,
'
code-block
'
],
[{
'
list
'
:
'
ordered
'
},
{
'
list
'
:
'
bullet
'
}],
[{
'
list
'
:
'
ordered
'
},
{
'
list
'
:
'
bullet
'
}],
// [{ 'script': 'sub' }, { 'script': 'super' }],
[{
'
indent
'
:
'
-1
'
},
{
'
indent
'
:
'
+1
'
}],
[{
'
align
'
:
[]
}],
[{
'
direction
'
:
'
rtl
'
}],
[{
'
indent
'
:
'
-1
'
},
{
'
indent
'
:
'
+1
'
}],
[{
'
align
'
:
[]
}],
[{
'
direction
'
:
'
rtl
'
}],
// [{ 'font': [] }],
[
'
clean
'
],
[
'
link
'
,
'
image
'
]
[
'
link
'
,
]
]
},
placeholder
:
'
内容...
'
,
placeholder
:
'
请输入竞赛公告
内容...
'
,
readOnly
:
false
}
}
},
computed
:
{
classes
()
{
classes
()
{
return
[
{
'
i-quill-no-border
'
:
!
this
.
border
}
];
},
styles
()
{
styles
()
{
let
style
=
{};
if
(
this
.
minHeight
)
{
style
.
minHeight
=
`
${
this
.
minHeight
}
px`
;
...
...
@@ -79,9 +80,10 @@
},
watch
:
{
value
:
{
handler
(
val
)
{
handler
(
val
)
{
if
(
val
!==
this
.
currentValue
)
{
this
.
currentValue
=
val
;
if
(
this
.
Quill
)
{
this
.
Quill
.
pasteHTML
(
this
.
value
);
}
...
...
@@ -91,7 +93,7 @@
}
},
methods
:
{
init
()
{
init
()
{
const
editor
=
this
.
$refs
.
editor
;
// 初始化编辑器
this
.
Quill
=
new
Quill
(
editor
,
this
.
options
);
...
...
@@ -106,8 +108,9 @@
this
.
currentValue
=
html
;
// 发出事件 v-model
this
.
$emit
(
'
input
'
,
html
);
this
.
$emit
(
'
setRichTextValue
'
,
html
);
// 发出事件
this
.
$emit
(
'
on-change
'
,
{
html
,
text
,
quill
});
this
.
$emit
(
'
on-change
'
,
{
html
,
text
,
quill
});
});
// 将一些 quill 自带的事件传递出去
this
.
Quill
.
on
(
'
text-change
'
,
(
delta
,
oldDelta
,
source
)
=>
{
...
...
@@ -121,23 +124,24 @@
});
}
},
mounted
()
{
mounted
()
{
this
.
init
();
},
beforeDestroy
()
{
beforeDestroy
()
{
// 在组件销毁后销毁实例
this
.
Quill
=
null
;
}
}
}
</
script
>
<
style
lang=
"less"
>
.i-quill-no-border
{
.ql-toolbar.ql-snow
{
.i-quill-no-border
{
.ql-toolbar.ql-snow
{
border: none;
border-bottom: 1px solid #e8eaec;
}
.ql-container.ql-snow{
.ql-container.ql-snow {
border: none;
}
}
}
</
style
>
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录