Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
08eb72e5
authored
Apr 22, 2023
by
dhb52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: mp/WxReply objCache => tabCache
parent
d99f9e98
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/views/mp/components/wx-reply/main.vue
+3
-3
No files found.
src/views/mp/components/wx-reply/main.vue
View file @
08eb72e5
...
...
@@ -84,7 +84,7 @@ const reply = computed<Reply>({
set
:
(
val
)
=>
emit
(
'update:modelValue'
,
val
)
})
// 作为多个标签保存各自Reply的缓存
const
obj
Cache
=
new
Map
<
ReplyType
,
Reply
>
()
const
tab
Cache
=
new
Map
<
ReplyType
,
Reply
>
()
// 采用独立的ref来保存当前tab,避免在watch标签变化,对reply进行赋值会产生了循环调用
const
currentTab
=
ref
<
ReplyType
>
(
props
.
modelValue
.
type
||
ReplyType
.
Text
)
...
...
@@ -97,10 +97,10 @@ watch(
return
}
obj
Cache
.
set
(
oldTab
,
unref
(
reply
))
tab
Cache
.
set
(
oldTab
,
unref
(
reply
))
// 从缓存里面取出新tab内容,有则覆盖Reply,没有则创建空Reply
const
temp
=
obj
Cache
.
get
(
newTab
)
const
temp
=
tab
Cache
.
get
(
newTab
)
if
(
temp
)
{
reply
.
value
=
temp
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment