Skip to content

Commit

Permalink
增加提示框显示时长
Browse files Browse the repository at this point in the history
  • Loading branch information
lanyuanxiaoyao committed Dec 10, 2022
1 parent beeeb84 commit 5eab2c1
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/utils/notify/NotifyUtils.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import Toastify from 'toastify-js'
import StartToastifyInstance from 'toastify-js'

const style = {
'border-radius': '5px',
'border': '1px solid',
'font-size': 'smaller',
}

const commonOption: StartToastifyInstance.Options = {
duration: 2000,
close: true,
style: {
'border-radius': '5px',
'border': '1px solid',
'font-size': 'smaller',
},
}

export const toastInfo: (text: string) => void = text => {
Toastify({
text: text,
duration: 1500,
close: true,
...commonOption,
style: {
...style,
...commonOption.style,
'background': '#5755d9',
'border-color': '#2e2bd9',
},
Expand All @@ -22,10 +32,9 @@ export const toastInfo: (text: string) => void = text => {
export const toastSuccess: (text: string) => void = text => {
Toastify({
text: text,
duration: 1500,
close: true,
...commonOption,
style: {
...style,
...commonOption.style,
'background': '#32b643',
'border-color': '#2ca137',
},
Expand All @@ -35,10 +44,9 @@ export const toastSuccess: (text: string) => void = text => {
export const toastWarning: (text: string) => void = text => {
Toastify({
text: text,
duration: 1500,
close: true,
...commonOption,
style: {
...style,
...commonOption.style,
'background': '#ffb700',
'border-color': '#e39e00',
},
Expand All @@ -48,10 +56,9 @@ export const toastWarning: (text: string) => void = text => {
export const toastError: (text: string) => void = text => {
Toastify({
text: text,
duration: 1500,
close: true,
...commonOption,
style: {
...style,
...commonOption.style,
'background': '#e85600',
'border-color': '#cb4d00',
},
Expand Down

0 comments on commit 5eab2c1

Please sign in to comment.