Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporate-culture-qd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王立鹏
corporate-culture-qd
Commits
98e8a720
Commit
98e8a720
authored
Mar 17, 2026
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复toRef引用失效问题
parent
c2615073
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
useResetData.ts
src/hooks/useResetData.ts
+9
-4
index.vue
src/views/backend/goodsDistribution/index.vue
+0
-4
No files found.
src/hooks/useResetData.ts
View file @
98e8a720
export
function
useResetData
<
T
>
(
initialValue
:
T
)
{
const
state
=
ref
(
structuredClone
(
initialValue
))
const
reset
=
()
=>
{
// state.value = structuredClone(initialValue)
// 优化 防止 出现类似toRef引用丢失问题
Object
.
assign
(
state
.
value
,
structuredClone
(
initialValue
))
state
.
value
=
structuredClone
(
initialValue
)
}
return
[
state
,
reset
]
as
[
Ref
<
T
>
,
()
=>
void
]
const
forReset
=
()
=>
{
// for循环便利 重置 避免部分属性使用到toRef引用丢失问题
for
(
const
key
in
initialValue
)
{
state
.
value
[
key
]
=
initialValue
[
key
]
}
}
return
[
state
,
reset
,
forReset
]
as
[
Ref
<
T
>
,
()
=>
void
,
()
=>
void
]
}
src/views/backend/goodsDistribution/index.vue
View file @
98e8a720
...
...
@@ -248,10 +248,6 @@ const columns: ExportColumn<BackendShopItemDto>[] = [
return
value
===
0
?
'待发放'
:
value
===
1
?
'已发放'
:
'已取消'
},
},
{
title
:
'发放人备注'
,
key
:
'memo'
,
},
]
// 对话框
...
...
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