mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
fix(popover): __placeableEnabled not correct
This commit is contained in:
parent
fdf2c74b92
commit
f1cea30192
@ -2,6 +2,7 @@ import {
|
||||
h,
|
||||
ref,
|
||||
computed,
|
||||
watch,
|
||||
Fragment,
|
||||
createTextVNode
|
||||
} from 'vue'
|
||||
@ -52,38 +53,6 @@ export default {
|
||||
NPopover: this
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
// setup show
|
||||
const controlledShowRef = computed(() => props.show)
|
||||
const uncontrolledShowRef = ref(props.defaultShow)
|
||||
const mergedShowWithoutDisabledRef = useMergedState(
|
||||
controlledShowRef,
|
||||
uncontrolledShowRef
|
||||
)
|
||||
const mergedShowRef = computed(() => {
|
||||
return props.disabled ? false : mergedShowWithoutDisabledRef.value
|
||||
})
|
||||
// setup show-arrow
|
||||
const compatibleShowArrowRef = useCompitable(props, [
|
||||
'arrow',
|
||||
'showArrow'
|
||||
])
|
||||
return {
|
||||
isMounted: useIsMounted(),
|
||||
// if to show popover body
|
||||
uncontrolledShow: uncontrolledShowRef,
|
||||
mergedShow: mergedShowRef,
|
||||
compatibleShowArrow: compatibleShowArrowRef
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showTimerId: null,
|
||||
hideTimerId: null,
|
||||
triggerVNode: null,
|
||||
bodyInstance: null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
@ -191,6 +160,43 @@ export default {
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
// setup show
|
||||
const controlledShowRef = computed(() => props.show)
|
||||
const uncontrolledShowRef = ref(props.defaultShow)
|
||||
const mergedShowWithoutDisabledRef = useMergedState(
|
||||
controlledShowRef,
|
||||
uncontrolledShowRef
|
||||
)
|
||||
const mergedShowRef = computed(() => {
|
||||
return props.disabled ? false : mergedShowWithoutDisabledRef.value
|
||||
})
|
||||
// setup show-arrow
|
||||
const compatibleShowArrowRef = useCompitable(props, [
|
||||
'arrow',
|
||||
'showArrow'
|
||||
])
|
||||
watch(mergedShowRef, value => {
|
||||
if (props.showWatcher) {
|
||||
props.showWatcher(value)
|
||||
}
|
||||
})
|
||||
return {
|
||||
isMounted: useIsMounted(),
|
||||
// if to show popover body
|
||||
uncontrolledShow: uncontrolledShowRef,
|
||||
mergedShow: mergedShowRef,
|
||||
compatibleShowArrow: compatibleShowArrowRef
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showTimerId: null,
|
||||
hideTimerId: null,
|
||||
triggerVNode: null,
|
||||
bodyInstance: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
syncPosition () {
|
||||
if (this.bodyInstance) {
|
||||
|
@ -106,6 +106,11 @@ export default {
|
||||
__placeableEnabled: this.show
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show (value) {
|
||||
if (value) this.__placeableEnabled = true
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.NPopover.bodyInstance = this
|
||||
},
|
||||
@ -196,9 +201,6 @@ export default {
|
||||
h(Transition, {
|
||||
name: 'popover-body-transition',
|
||||
appear: this.NPopover.isMounted,
|
||||
onEnter: () => {
|
||||
this.__placeableEnabled = true
|
||||
},
|
||||
onAfterLeave: () => {
|
||||
this.__placeableEnabled = false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user