This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化layer

old
宇天 2021-06-10 23:35:03 +08:00
parent 5cf6d277cb
commit 9d45ca3cbf
1 changed files with 13 additions and 8 deletions

View File

@ -336,13 +336,13 @@ export default class Layer {
switch (val) {
case 'alert':
while (btns.length > 1) {
btns.splice(0, 1)
btns.shift()
}
break
case 'confirm':
case 'prompt':
while (btns.length > 2) {
btns.splice(0, 1)
btns.shift()
}
break
case 'toast':
@ -715,17 +715,22 @@ function _layer(opt) {
}
Object.assign(_layer, {
alert(content, title = lang.TITLE) {
alert(content, title = lang.TITLE, btns = false) {
if (typeof title === 'object') {
btns = title
title = lang.TITLE
}
return this({
type: 'alert',
title,
content,
mask: true
mask: true,
btns
})
},
confirm(content, title = lang.TITLE, intercept) {
if (typeof title === 'function') {
intercept = title
confirm(content, title = lang.TITLE, btns = false) {
if (typeof title === 'object') {
btns = title
title = lang.TITLE
}
return this({
@ -733,7 +738,7 @@ Object.assign(_layer, {
title,
content,
mask: true,
intercept
btns
})
},
prompt(title = lang.TITLE, defaultValue = '', intercept) {