Skip to content

Commit

Permalink
fix: delet garbage code and change invoke place
Browse files Browse the repository at this point in the history
  • Loading branch information
wuls committed Nov 28, 2020
1 parent 884d2a3 commit c6aa979
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 6 additions & 6 deletions packages/message-box/src/MessageBox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// #todo
import { render, defineComponent, h, isVNode } from 'vue'
import { defineComponent, isVNode } from 'vue'
import { createComponent } from '../../../src/use/component'
import msgboxVue from './MessageBox.vue'
import merge from '../../../src/utils/merge'
const messageBoxConstructor = defineComponent(msgboxVue)
Expand Down Expand Up @@ -49,9 +50,9 @@ const defaultCallback = (action) => {
if (currentMsg) {
if (currentMsg.resolve) {
if (action === 'confirm') {
if (instance.component.vnode.props.showInput) {
if (instance.vnode.props.showInput) {
currentMsg.resolve({
value: instance.component.setupState.state.inputValue,
value: instance.setupState.state.inputValue,
action
})
} else {
Expand All @@ -69,8 +70,7 @@ const defaultCallback = (action) => {

const initInstance = (currentMsg, VNode = null) => {
defaults.callback = defaultCallback
instance = h(messageBoxConstructor, currentMsg.options, VNode)
render(instance, document.createElement('div'))
instance = createComponent(messageBoxConstructor, currentMsg.options, VNode)
}

const showNextMsg = () => {
Expand Down Expand Up @@ -102,7 +102,7 @@ const showNextMsg = () => {
options[prop] = true
}
})
document.body.appendChild(instance.el)
document.body.appendChild(instance.vnode.el)
}
// }
}
Expand Down
2 changes: 0 additions & 2 deletions packages/message-box/src/MessageBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ export default {
state.action = action
if (typeof unref(beforeClose) === 'function') {
const close = getSafeClose()
console.log(instance.vnode)
unref(beforeClose)(action, instance.vnode, close)
} else {
doClose()
Expand Down Expand Up @@ -425,7 +424,6 @@ export default {
})
}
const focusAfterClosed = document.activeElement
console.log(instance)
messageBox = new Dialog(
instance.vnode.el,
focusAfterClosed,
Expand Down

0 comments on commit c6aa979

Please sign in to comment.