Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a8cb802b
authored
Jun 06, 2023
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
quill
1 parent
009c3a02
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
vue3-lw-pc/src/components/Upload.vue
vue3-lw-pc/src/components/common/QuillEditor.vue
vue3-lw-pc/src/components/Upload.vue
View file @
a8cb802
...
@@ -10,6 +10,7 @@ import OSS from 'ali-oss'
...
@@ -10,6 +10,7 @@ import OSS from 'ali-oss'
export
default
{
export
default
{
components
:
{},
components
:
{},
emits
:
[
'update:fileUrl'
,
'update:fileName'
,
'update:fileList'
,
'upSuccess'
,
'getPicUrl'
,
'loadingChange'
],
props
:
{
props
:
{
// 单文件上传时使用
// 单文件上传时使用
fileUrl
:
{
fileUrl
:
{
...
...
vue3-lw-pc/src/components/common/QuillEditor.vue
View file @
a8cb802
...
@@ -25,12 +25,13 @@ export default {
...
@@ -25,12 +25,13 @@ export default {
type
:
String
,
type
:
String
,
},
},
},
},
emits
:
[
'change'
],
watch
:
{
watch
:
{
value
(
val
)
{
value
(
val
)
{
this
.
content
=
val
this
.
content
=
val
},
},
imgUrl
(
val
)
{
imgUrl
(
val
)
{
let
quill
=
this
.
$refs
.
quill
.
quill
let
quill
=
this
.
$refs
.
quill
.
getQuill
()
let
length
=
quill
.
getSelection
().
index
//光标位置
let
length
=
quill
.
getSelection
().
index
//光标位置
// 插入图片 图片地址
// 插入图片 图片地址
quill
.
insertEmbed
(
length
,
'image'
,
val
)
quill
.
insertEmbed
(
length
,
'image'
,
val
)
...
@@ -96,11 +97,11 @@ export default {
...
@@ -96,11 +97,11 @@ export default {
this
.
uploadLoading
=
percent
>
0
&&
percent
<
100
this
.
uploadLoading
=
percent
>
0
&&
percent
<
100
},
},
insertContent
(
emoji
)
{
insertContent
(
emoji
)
{
let
quill
=
this
.
$refs
.
quill
let
quill
=
this
.
$refs
.
quill
.
getQuill
()
quill
.
focus
()
quill
.
focus
()
let
length
=
0
//
quill.getSelection().index //光标位置
let
length
=
quill
.
getSelection
().
index
//光标位置
quill
.
setHTML
(
length
,
emoji
)
quill
.
insertText
(
length
,
emoji
)
//
quill.setSelection(length + 2) //光标后移,表情占2位。所以+2
quill
.
setSelection
(
length
+
2
)
//光标后移,表情占2位。所以+2
},
},
},
},
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment