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

130 lines
4.2 KiB
Vue
Raw Normal View History

2018-01-15 17:33:34 +08:00
<template>
<div id="components-popconfirm-demo-placement">
<md>
## 位置
位置有十二个方向如需箭头指向目标元素中心可以设置 `arrowPointAtCenter`
</md>
<div :style="{ marginLeft: `${buttonWidth}px`, whiteSpace: 'nowrap' }">
<Popconfirm placement="topLeft" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>TL</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
<Popconfirm placement="top" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>Top</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
<Popconfirm placement="topRight" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>TR</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
</div>
<div :style="{ width: `${buttonWidth}px`, float: 'left' }">
<Popconfirm placement="leftTop" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>LT</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
<Popconfirm placement="left" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>Left</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
<Popconfirm placement="leftBottom" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>LB</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
</div>
<div :style="{ width: `${buttonWidth}px`, marginLeft: `${buttonWidth * 4 + 24 }px`}">
<Popconfirm placement="rightTop" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>RT</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
<Popconfirm placement="right" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>Right</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
<Popconfirm placement="rightBottom" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>RB</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
</div>
<div :style="{ marginLeft: `${buttonWidth}px`, clear: 'both', whiteSpace: 'nowrap' }">
<Popconfirm placement="bottomLeft" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>BL</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
<Popconfirm placement="bottom" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
</template>
2018-01-23 18:55:39 +08:00
<a-button>Bottom</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
<Popconfirm placement="bottomRight" okText="Yes" cancelText="No" @confirm="confirm">
<template slot="title">
2018-01-19 18:01:43 +08:00
<p>Are you sure delete this task?</p>
<p>Are you sure delete this task?</p>
2018-01-15 17:33:34 +08:00
</template>
2018-01-23 18:55:39 +08:00
<a-button>BR</a-button>
2018-01-15 17:33:34 +08:00
</Popconfirm>
</div>
</div>
</template>
<script>
import { Popconfirm, Button } from 'antd'
export default {
data () {
return {
buttonWidth: 70,
}
},
methods: {
confirm () {
console.log('Click on Yes')
},
},
components: {
Popconfirm,
2018-01-23 18:55:39 +08:00
2018-01-15 17:33:34 +08:00
},
}
</script>
<style>
#components-popconfirm-demo-placement .ant-btn {
width: 70px;
text-align: center;
padding: 0;
margin-right: 8px;
margin-bottom: 8px;
}
</style>