You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/tooltip/demo/placement.md

117 lines
2.9 KiB

7 years ago
<cn>
#### 位置
位置有 12 个方向。
</cn>
<us>
#### Placement
The ToolTip has 12 placements choice.
</us>
```html
<template>
<div id="components-a-tooltip-demo-placement">
<div :style="{ marginLeft: `${buttonWidth}px`, whiteSpace: 'nowrap' }">
<a-tooltip placement="topLeft" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>TL</a-button>
</a-tooltip>
<a-tooltip placement="top" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>Top</a-button>
</a-tooltip>
<a-tooltip placement="topRight" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>TR</a-button>
</a-tooltip>
7 years ago
</div>
<div :style="{ width: `${buttonWidth}px`, float: 'left' }">
<a-tooltip placement="leftTop" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>LT</a-button>
</a-tooltip>
<a-tooltip placement="left" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>Left</a-button>
</a-tooltip>
<a-tooltip placement="leftBottom" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>LB</a-button>
</a-tooltip>
7 years ago
</div>
<div :style="{ width: `${buttonWidth}px`, marginLeft: `${buttonWidth * 4 + 24 }px`}">
<a-tooltip placement="rightTop" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>RT</a-button>
</a-tooltip>
<a-tooltip placement="right" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>Right</a-button>
</a-tooltip>
<a-tooltip placement="rightBottom" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>RB</a-button>
</a-tooltip>
7 years ago
</div>
<div :style="{ marginLeft: `${buttonWidth}px`, clear: 'both', whiteSpace: 'nowrap' }">
<a-tooltip placement="bottomLeft" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>BL</a-button>
</a-tooltip>
<a-tooltip placement="bottom" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>Bottom</a-button>
</a-tooltip>
<a-tooltip placement="bottomRight" >
7 years ago
<template slot="title">
<span>prompt text</span>
</template>
<a-button>BR</a-button>
</a-tooltip>
7 years ago
</div>
</div>
</template>
<script>
export default {
data () {
return {
buttonWidth: 70,
}
},
}
</script>
<style scoped>
#components-a-tooltip-demo-placement .ant-btn {
width: 70px;
text-align: center;
padding: 0;
margin-right: 8px;
margin-bottom: 8px;
}
</style>
```