mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-12 12:25:16 +08:00
refactor(confirm): rename api
This commit is contained in:
parent
752af2c0eb
commit
f37375baf8
@ -4,9 +4,11 @@ import { install } from '../../utils/installThemeAwarableProperty'
|
||||
|
||||
ConfirmPlugin.install = function (Vue) {
|
||||
ConfirmPlugin.Vue = Vue
|
||||
install(Vue, ConfirmPlugin, '$NModal')
|
||||
install(Vue, ConfirmPlugin, '$NConfirm')
|
||||
Vue.component(Confirm.name, Confirm)
|
||||
/** deprecated names */
|
||||
Vue.component('NNimbusConfirmCard', Confirm)
|
||||
install(Vue, ConfirmPlugin, '$NModal')
|
||||
}
|
||||
|
||||
export default ConfirmPlugin
|
||||
|
@ -49,7 +49,7 @@ export default {
|
||||
onNegativeClick: () => {
|
||||
this.active = false
|
||||
},
|
||||
onCloseClick: () => {
|
||||
onClose: () => {
|
||||
this.active = false
|
||||
},
|
||||
instances: null
|
||||
@ -67,7 +67,7 @@ export default {
|
||||
this.onNegativeClick(this.hide)
|
||||
},
|
||||
handleCloseClick () {
|
||||
this.onCloseClick(this.hide)
|
||||
this.onClose(this.hide)
|
||||
},
|
||||
hide () {
|
||||
this.active = false
|
||||
|
@ -2,7 +2,7 @@ import ConfirmEnvironment from './ConfirmEnvironment.vue'
|
||||
|
||||
const instances = new Set()
|
||||
|
||||
function setDataOnConfirmInstance (data, instance) {
|
||||
function updateConfirm (data, instance) {
|
||||
for (const key of Object.keys(data)) {
|
||||
if (key in instance.$data) {
|
||||
instance.$data[key] = data[key]
|
||||
@ -21,8 +21,11 @@ export default {
|
||||
return instance
|
||||
},
|
||||
confirm (options) {
|
||||
this.open.bind(this)(options)
|
||||
},
|
||||
open (options) {
|
||||
const instance = this.createInstance()
|
||||
setDataOnConfirmInstance(
|
||||
updateConfirm(
|
||||
{
|
||||
type: 'confirm',
|
||||
active: true,
|
||||
@ -35,7 +38,7 @@ export default {
|
||||
},
|
||||
error (options) {
|
||||
const instance = this.createInstance()
|
||||
setDataOnConfirmInstance(
|
||||
updateConfirm(
|
||||
{
|
||||
type: 'error',
|
||||
active: true,
|
||||
@ -48,7 +51,7 @@ export default {
|
||||
},
|
||||
success (options) {
|
||||
const instance = this.createInstance()
|
||||
setDataOnConfirmInstance(
|
||||
updateConfirm(
|
||||
{
|
||||
type: 'success',
|
||||
active: true,
|
||||
|
Loading…
Reference in New Issue
Block a user