Skip to content

Commit

Permalink
fix: notify组件不同类型关闭时间对齐华为云规范 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
rayhaoqin authored Feb 24, 2023
1 parent 231179a commit c98486b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/notify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ const IconMap = {
success: iconSuccessful()
}

const durationMap = {
info: 5000,
success: 5000,
warning: 10000,
error: 10000
}

const positionList = ['top-right', 'bottom-right']

const debounce = (fn, debounceDelay) => {
Expand Down Expand Up @@ -55,6 +62,7 @@ const notify = (options) => {
options.type = 'info'
}

options.duration = options.duration ? options.duration : durationMap[options.type]
options.position = !~positionList.indexOf(options.position) ? 'bottom-right' : options.position
!options.statusIcon && options.type && (options.statusIcon = IconMap[options.type])

Expand Down
2 changes: 1 addition & 1 deletion packages/notify/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
customClass: [String, Object],
duration: {
type: Number,
default: 4500
default: 0
},
message: [String, Function],
onClose: Function,
Expand Down

0 comments on commit c98486b

Please sign in to comment.