Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
liyeyun
Project
Project
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
cfld-frontend
liyeyun
Commits
34fe256f
Commit
34fe256f
authored
Dec 13, 2023
by
王玉鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: message提示时长修改
parent
f3bf8cd1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
29 deletions
+22
-29
useMessage.ts
src/composable/useMessage.ts
+22
-29
No files found.
src/composable/useMessage.ts
View file @
34fe256f
import
{
ElMessage
}
from
'element-plus'
;
import
{
ElMessage
,
type
MessageOptionsWithType
,
type
MessageParamsWithType
,
type
messageType
,
}
from
'element-plus'
;
import
'element-plus/theme-chalk/el-message.css'
;
/**
* el-message提示
*/
export
function
useMessage
()
{
const
commonOptions
:
MessageOptionsWithType
=
{
offset
:
50
,
duration
:
1000
,
};
const
fn
=
(
type
:
messageType
)
=>
{
return
(
options
:
MessageParamsWithType
)
=>
{
return
ElMessage
[
type
]({
...
commonOptions
,
...(
typeof
options
===
'string'
?
{
message
:
options
}
:
options
),
});
};
};
return
{
message
:
{
success
:
(
message
:
string
)
=>
{
ElMessage
({
message
,
offset
:
50
,
type
:
'success'
,
});
},
error
:
(
message
:
string
)
=>
{
ElMessage
({
message
,
offset
:
50
,
type
:
'error'
,
});
},
warning
:
(
message
:
string
)
=>
{
ElMessage
({
message
,
offset
:
50
,
type
:
'warning'
,
});
},
info
:
(
message
:
string
)
=>
{
ElMessage
({
message
,
offset
:
50
,
type
:
'info'
,
});
},
success
:
fn
(
'success'
),
error
:
fn
(
'error'
),
info
:
fn
(
'info'
),
warning
:
fn
(
'warning'
),
},
};
}
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