ant-design-vue/components/vc-trigger/demo/nested.vue

88 lines
2.3 KiB
Vue
Raw Normal View History

2017-12-25 10:08:36 +00:00
<script>
import Trigger from '../index'
import '../assets/index.less'
const builtinPlacements = {
left: {
points: ['cr', 'cl'],
},
right: {
points: ['cl', 'cr'],
},
top: {
points: ['bc', 'tc'],
},
bottom: {
points: ['tc', 'bc'],
},
topLeft: {
points: ['bl', 'tl'],
},
topRight: {
points: ['br', 'tr'],
},
bottomRight: {
points: ['tr', 'br'],
},
bottomLeft: {
points: ['tl', 'bl'],
},
}
const popupBorderStyle = {
border: '1px solid red',
padding: '10px',
}
export default {
render () {
return (
2017-12-26 11:04:28 +00:00
<div style={{ margin: '200px' }}>
<div>
2017-12-25 10:08:36 +00:00
<Trigger
2017-12-26 11:04:28 +00:00
popupPlacement='left'
2017-12-25 10:08:36 +00:00
action={['click']}
builtinPlacements={builtinPlacements}
2017-12-26 11:04:28 +00:00
>
<div slot='popup' style={popupBorderStyle}>i am a click popup</div>
<span>
<div ref='saveContainerRef1' />
<Trigger
popupPlacement='bottom'
action={['hover']}
builtinPlacements={builtinPlacements}
getPopupContainer={() => this.$refs.saveContainerRef1}
>
<div slot='popup' style={popupBorderStyle}>i am a hover popup</div>
<span href='#' style={{ margin: '20px' }}>trigger</span>
</Trigger>
</span>
</Trigger>
</div>
{ false ? <div style={{ margin: '50px' }}>
<Trigger
popupPlacement='right'
action={['click', 'hover']}
builtinPlacements={builtinPlacements}
2017-12-25 10:08:36 +00:00
>
<div style={popupBorderStyle} slot='popup' onClick={(e) => { e.stopPropagation() }}>
2017-12-26 11:04:28 +00:00
<div ref='saveContainerRef' />
<Trigger
popupPlacement='bottom'
action={['click']}
builtinPlacements={builtinPlacements}
getPopupContainer={() => this.$refs.saveContainerRef}
>
<div slot='popup' style={popupBorderStyle}>I am inner Trigger Popup</div>
<span href='#' style={{ margin: 20 }}>clickToShowInnerTrigger</span>
</Trigger>
2017-12-25 10:08:36 +00:00
</div>
<span href='#' style={{ margin: '20px' }} onClick={console.log}>trigger</span>
</Trigger>
2017-12-26 11:04:28 +00:00
</div> : null}
2017-12-25 10:08:36 +00:00
</div>
)
},
}
</script>