style: 主题相关调整
This commit is contained in:
parent
0636ac4716
commit
c8495f7a5f
@ -6,44 +6,20 @@ import { useDialog } from 'naive-ui'
|
|||||||
|
|
||||||
const NDialog = useDialog()
|
const NDialog = useDialog()
|
||||||
|
|
||||||
class Dialog {
|
NDialog.confirm = function (option = {}) {
|
||||||
success(title, option) {
|
const showIcon = !isNullOrUndef(option.title)
|
||||||
return this.showDialog('success', { title, ...option })
|
return NDialog[option.type || 'warning']({
|
||||||
}
|
showIcon,
|
||||||
|
positiveText: '确定',
|
||||||
warning(title, option) {
|
negativeText: '取消',
|
||||||
return this.showDialog('warning', { title, ...option })
|
onPositiveClick: option.confirm,
|
||||||
}
|
onNegativeClick: option.cancel,
|
||||||
|
onMaskClick: option.cancel,
|
||||||
error(title, option) {
|
...option,
|
||||||
return this.showDialog('error', { title, ...option })
|
})
|
||||||
}
|
|
||||||
|
|
||||||
showDialog(type = 'success', option) {
|
|
||||||
if (isNullOrUndef(option.title)) {
|
|
||||||
// ! 没有title的情况
|
|
||||||
option.showIcon = false
|
|
||||||
}
|
|
||||||
return NDialog[type]({
|
|
||||||
positiveText: 'OK',
|
|
||||||
closable: false,
|
|
||||||
...option,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
confirm(option = {}) {
|
|
||||||
return this.showDialog(option.type || 'error', {
|
|
||||||
positiveText: '确定',
|
|
||||||
negativeText: '取消',
|
|
||||||
onPositiveClick: option.confirm,
|
|
||||||
onNegativeClick: option.cancel,
|
|
||||||
onMaskClick: option.cancel,
|
|
||||||
...option,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window['$dialog'] = new Dialog()
|
window['$dialog'] = NDialog
|
||||||
Object.freeze(window.$dialog)
|
Object.freeze(window.$dialog)
|
||||||
Object.defineProperty(window, '$dialog', {
|
Object.defineProperty(window, '$dialog', {
|
||||||
configurable: false,
|
configurable: false,
|
||||||
|
@ -26,6 +26,8 @@ const options = [
|
|||||||
function handleSelect(key) {
|
function handleSelect(key) {
|
||||||
if (key === 'logout') {
|
if (key === 'logout') {
|
||||||
$dialog.confirm({
|
$dialog.confirm({
|
||||||
|
title: '提示',
|
||||||
|
type: 'info',
|
||||||
content: '确认退出?',
|
content: '确认退出?',
|
||||||
confirm() {
|
confirm() {
|
||||||
userStore.logout()
|
userStore.logout()
|
||||||
|
@ -11,11 +11,7 @@
|
|||||||
"primaryColor": "#316C72FF",
|
"primaryColor": "#316C72FF",
|
||||||
"primaryColorHover": "#316C72E3",
|
"primaryColorHover": "#316C72E3",
|
||||||
"primaryColorPressed": "#2B4C59FF",
|
"primaryColorPressed": "#2B4C59FF",
|
||||||
"primaryColorSuppl": "#316C7263",
|
"primaryColorSuppl": "#316C7263"
|
||||||
"successColor": "#316C72FF",
|
|
||||||
"successColorHover": "#316C72E3",
|
|
||||||
"successColorPressed": "#2B4C59FF",
|
|
||||||
"successColorSuppl": "#316C7263"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@ const handleDelete = function () {
|
|||||||
$dialog.confirm({
|
$dialog.confirm({
|
||||||
content: '确认删除?',
|
content: '确认删除?',
|
||||||
confirm() {
|
confirm() {
|
||||||
$dialog.success('删除成功', { positiveText: '我知道了' })
|
$message.success('删除成功')
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
$dialog.warning('已取消', { closable: true })
|
$message.warning('已取消')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user