ant-design-vue/components/popover/demo/placement.vue

161 lines
3.7 KiB
Vue
Raw Normal View History

2018-01-12 08:10:41 +00:00
<template>
<div id="components-popover-demo-placement">
<md>
## 位置
位置有 12 个方向
</md>
<div :style="{ marginLeft: `${buttonWidth}px`, whiteSpace: 'nowrap' }">
<Popover placement="topLeft">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>TL</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
<Popover placement="top">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>Top</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
<Popover placement="topRight">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>TR</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
</div>
<div :style="{ width: `${buttonWidth}px`, float: 'left' }">
<Popover placement="leftTop">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>LT</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
<Popover placement="left">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>Left</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
<Popover placement="leftBottom">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>LB</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
</div>
<div :style="{ width: `${buttonWidth}px`, marginLeft: `${buttonWidth * 4 + 24 }px`}">
<Popover placement="rightTop">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>RT</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
<Popover placement="right">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>Right</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
<Popover placement="rightBottom">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>RB</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
</div>
<div :style="{ marginLeft: `${buttonWidth}px`, clear: 'both', whiteSpace: 'nowrap' }">
<Popover placement="bottomLeft">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>BL</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
<Popover placement="bottom">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>Bottom</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
<Popover placement="bottomRight">
<template slot="content">
2018-01-19 10:01:43 +00:00
<p>Content</p>
<p>Content</p>
2018-01-12 08:10:41 +00:00
</template>
<template slot="title">
<span>Title</span>
</template>
2018-01-23 10:55:39 +00:00
<a-button>BR</a-button>
2018-01-12 08:10:41 +00:00
</Popover>
</div>
</div>
</template>
<script>
import { Popover, Button } from 'antd'
export default {
data () {
return {
buttonWidth: 70,
}
},
components: {
Popover,
2018-01-23 10:55:39 +00:00
2018-01-12 08:10:41 +00:00
},
}
</script>
<style>
#components-popover-demo-placement .ant-btn {
width: 70px;
text-align: center;
padding: 0;
margin-right: 8px;
margin-bottom: 8px;
}
</style>