Skip to content

Commit

Permalink
fix: use vnode variable instead of proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
wuls committed Nov 27, 2020
1 parent 6faa4b7 commit 89ed24a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/message-box/src/MessageBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ const defaultCallback = (action) => {
// }
if (currentMsg.resolve) {
if (action === 'confirm') {
if (instance.component.proxy.showInput) {
if (instance.component.vnode.showInput) {
currentMsg.resolve({
value: instance.component.proxy.state.inputValue,
value: instance.component.vnode.state.inputValue,
action
})
} else {
Expand Down
11 changes: 6 additions & 5 deletions packages/message-box/src/MessageBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export default {
}
nextTick(() => {
if (state.action) {
unref(callback)(state.action, instance.proxy)
unref(callback)(state.action, instance.vnode)
}
})
}
Expand All @@ -367,7 +367,7 @@ export default {
state.action = action
if (typeof unref(beforeClose) === 'function') {
const close = getSafeClose()
unref(beforeClose)(action, instance.proxy, close)
unref(beforeClose)(action, instance.vnode, close)
} else {
doClose()
}
Expand Down Expand Up @@ -403,10 +403,10 @@ export default {
return `el-button--primary ${unref(confirmButtonClass)}`
})
const getFirstFocus = () => {
const btn = instance.proxy.$el.querySelector(
const btn = instance.vnode.el.querySelector(
'.el-message-box__btns .el-button'
)
const title = instance.proxy.$el.querySelector(
const title = instance.vnode.el.querySelector(
'.el-message-box__btns .el-message-box__title'
)
return btn || title
Expand All @@ -428,8 +428,9 @@ export default {
})
}
const focusAfterClosed = document.activeElement
console.log(instance)
messageBox = new Dialog(
instance.proxy.$el,
instance.vnode.el,
focusAfterClosed,
getFirstFocus()
)
Expand Down

0 comments on commit 89ed24a

Please sign in to comment.