fix
parent
c0c7d95c01
commit
4657e729ef
|
@ -32,16 +32,20 @@ export default {
|
|||
},
|
||||
on: {},
|
||||
}
|
||||
return <Tooltip
|
||||
{...toolTipProps}
|
||||
>
|
||||
<template slot='title'>
|
||||
{inlineCollapsed && props.level === 1 ? cloneVNodes($slots.default, true) : ''}
|
||||
</template>
|
||||
<Item {...itemProps} ref='menuItem'>
|
||||
{$slots.default}
|
||||
</Item>
|
||||
</Tooltip>
|
||||
return (
|
||||
inlineCollapsed && props.level === 1
|
||||
? <Tooltip {...toolTipProps}>
|
||||
<template slot='title'>
|
||||
{ cloneVNodes($slots.default, true) }
|
||||
</template>
|
||||
<Item {...itemProps} ref='menuItem'>
|
||||
{$slots.default}
|
||||
</Item>
|
||||
</Tooltip>
|
||||
: <Item {...itemProps} ref='menuItem'>
|
||||
{$slots.default}
|
||||
</Item>
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -31,24 +31,22 @@ export default {
|
|||
},
|
||||
mounted () {
|
||||
this.$nextTick(() => {
|
||||
this._container = this.getContainer()
|
||||
this._container.appendChild(this.$el)
|
||||
this.initAlign = true
|
||||
})
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$el.remove()
|
||||
},
|
||||
beforeUpdate () {
|
||||
this.$nextTick(() => {
|
||||
const newContainer = this.getContainer()
|
||||
if (newContainer !== this._container) {
|
||||
this._container = newContainer
|
||||
this._container.appendChild(this.$el)
|
||||
this.$refs.alignInstance.forceAlign()
|
||||
}
|
||||
})
|
||||
},
|
||||
// beforeUpdate () {
|
||||
// this.$nextTick(() => {
|
||||
// const newContainer = this.getContainer()
|
||||
// if (newContainer !== this._container) {
|
||||
// this._container = newContainer
|
||||
// this._container.appendChild(this.$el)
|
||||
// this.$refs.alignInstance.forceAlign()
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
watch: {
|
||||
visible (val) {
|
||||
if (val) {
|
||||
|
@ -217,7 +215,7 @@ export default {
|
|||
render () {
|
||||
const { destroyPopup, getMaskElement, getPopupElement, initAlign } = this
|
||||
return (
|
||||
<div style='position: absolute; top: 0px; left: 0px; width: 100%;'>
|
||||
<div>
|
||||
{initAlign ? (
|
||||
getMaskElement(),
|
||||
destroyPopup
|
||||
|
|
|
@ -58,7 +58,7 @@ export default {
|
|||
},
|
||||
offsetX: undefined,
|
||||
offsetY: undefined,
|
||||
transitionName: '',
|
||||
transitionName: 'rc-trigger-popup-zoom',
|
||||
destroyPopupOnHide: false,
|
||||
}
|
||||
},
|
||||
|
@ -159,7 +159,7 @@ export default {
|
|||
</label>
|
||||
|
||||
<label>
|
||||
a-checkbox
|
||||
<a-checkbox
|
||||
value='rc-trigger-popup-zoom'
|
||||
onChange={this.onTransitionChange}
|
||||
checked={state.transitionName === 'rc-trigger-popup-zoom'}
|
||||
|
@ -172,7 +172,7 @@ export default {
|
|||
trigger:
|
||||
|
||||
<label>
|
||||
a-checkbox
|
||||
<a-checkbox
|
||||
value='hover'
|
||||
checked={!!trigger.hover}
|
||||
onChange={this.onTriggerChange}
|
||||
|
@ -180,7 +180,7 @@ export default {
|
|||
hover
|
||||
</label>
|
||||
<label>
|
||||
a-checkbox
|
||||
<a-checkbox
|
||||
value='focus'
|
||||
checked={!!trigger.focus}
|
||||
onChange={this.onTriggerChange}
|
||||
|
@ -188,7 +188,7 @@ export default {
|
|||
focus
|
||||
</label>
|
||||
<label>
|
||||
a-checkbox
|
||||
<a-checkbox
|
||||
value='click'
|
||||
checked={!!trigger.click}
|
||||
onChange={this.onTriggerChange}
|
||||
|
@ -196,7 +196,7 @@ export default {
|
|||
click
|
||||
</label>
|
||||
<label>
|
||||
a-checkbox
|
||||
<a-checkbox
|
||||
value='contextMenu'
|
||||
checked={!!trigger.contextMenu}
|
||||
onChange={this.onTriggerChange}
|
||||
|
@ -205,7 +205,7 @@ export default {
|
|||
</label>
|
||||
|
||||
<label>
|
||||
a-checkbox
|
||||
<a-checkbox
|
||||
checked={!!state.destroyPopupOnHide}
|
||||
onChange={this.handleDestroyPopupOnHide}
|
||||
/>
|
||||
|
@ -214,7 +214,7 @@ export default {
|
|||
|
||||
|
||||
<label>
|
||||
a-checkbox
|
||||
<a-checkbox
|
||||
checked={!!state.mask}
|
||||
onChange={this.onMask}
|
||||
/>
|
||||
|
@ -223,7 +223,7 @@ export default {
|
|||
|
||||
|
||||
<label>
|
||||
a-checkbox
|
||||
<a-checkbox
|
||||
checked={!!state.maskClosable}
|
||||
onChange={this.onMaskClosable}
|
||||
/>
|
||||
|
@ -270,7 +270,7 @@ export default {
|
|||
<div slot='popup' style={{ border: '1px solid red', padding: '10px', background: 'white' }}>
|
||||
i am a popup
|
||||
</div>
|
||||
<a href='#' style={{ margin: '20px' }} onClick={preventDefault}>trigger</a>
|
||||
<a-button onClick={preventDefault}>trigger</a-button>
|
||||
</Trigger>
|
||||
</div>
|
||||
</div>)
|
||||
|
|
|
@ -114,6 +114,7 @@ export default {
|
|||
if (this._component) {
|
||||
this._component.$destroy()
|
||||
this._component = null
|
||||
this.popupContainer.remove()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -329,6 +330,7 @@ export default {
|
|||
}
|
||||
if (!this._component) {
|
||||
const div = document.createElement('div')
|
||||
this.getContainer().appendChild(div)
|
||||
this._component = new Vue({
|
||||
data () {
|
||||
return {
|
||||
|
@ -360,9 +362,18 @@ export default {
|
|||
|
||||
getContainer () {
|
||||
const { $props: props } = this
|
||||
const popupContainer = document.createElement('div')
|
||||
// Make sure default popup container will never cause scrollbar appearing
|
||||
// https://github.com/react-component/trigger/issues/41
|
||||
popupContainer.style.position = 'absolute'
|
||||
popupContainer.style.top = '0'
|
||||
popupContainer.style.left = '0'
|
||||
popupContainer.style.width = '100%'
|
||||
const mountNode = props.getPopupContainer
|
||||
? props.getPopupContainer(this.$el) : props.getDocument().body
|
||||
return mountNode
|
||||
mountNode.appendChild(popupContainer)
|
||||
this.popupContainer = popupContainer
|
||||
return popupContainer
|
||||
},
|
||||
|
||||
setPopupVisible (sPopupVisible) {
|
||||
|
|
Loading…
Reference in New Issue