134 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Vue
		
	
	
			
		
		
	
	
			134 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Vue
		
	
	
| <docs>
 | ||
| ---
 | ||
| order: 3
 | ||
| title:
 | ||
|   zh-CN: 位置
 | ||
|   en-US: Placement
 | ||
| ---
 | ||
| 
 | ||
| ## zh-CN
 | ||
| 
 | ||
| 位置有十二个方向。如需箭头指向目标元素中心,可以设置 `arrowPointAtCenter`。
 | ||
| 
 | ||
| ## en-US
 | ||
| 
 | ||
| There are 12 `placement` options available. Use `arrowPointAtCenter` if you want arrow point at the center of target.
 | ||
| 
 | ||
| </docs>
 | ||
| 
 | ||
| <template>
 | ||
|   <div id="components-a-popconfirm-demo-placement">
 | ||
|     <div :style="{ marginLeft: `${buttonWidth}px`, whiteSpace: 'nowrap' }">
 | ||
|       <a-popconfirm placement="topLeft" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>TL</a-button>
 | ||
|       </a-popconfirm>
 | ||
|       <a-popconfirm placement="top" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>Top</a-button>
 | ||
|       </a-popconfirm>
 | ||
|       <a-popconfirm placement="topRight" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>TR</a-button>
 | ||
|       </a-popconfirm>
 | ||
|     </div>
 | ||
|     <div :style="{ width: `${buttonWidth}px`, float: 'left' }">
 | ||
|       <a-popconfirm placement="leftTop" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>LT</a-button>
 | ||
|       </a-popconfirm>
 | ||
|       <a-popconfirm placement="left" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>Left</a-button>
 | ||
|       </a-popconfirm>
 | ||
|       <a-popconfirm placement="leftBottom" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>LB</a-button>
 | ||
|       </a-popconfirm>
 | ||
|     </div>
 | ||
|     <div :style="{ width: `${buttonWidth}px`, marginLeft: `${buttonWidth * 4 + 24}px` }">
 | ||
|       <a-popconfirm placement="rightTop" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>RT</a-button>
 | ||
|       </a-popconfirm>
 | ||
|       <a-popconfirm placement="right" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>Right</a-button>
 | ||
|       </a-popconfirm>
 | ||
|       <a-popconfirm placement="rightBottom" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>RB</a-button>
 | ||
|       </a-popconfirm>
 | ||
|     </div>
 | ||
|     <div :style="{ marginLeft: `${buttonWidth}px`, clear: 'both', whiteSpace: 'nowrap' }">
 | ||
|       <a-popconfirm placement="bottomLeft" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>BL</a-button>
 | ||
|       </a-popconfirm>
 | ||
|       <a-popconfirm placement="bottom" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>Bottom</a-button>
 | ||
|       </a-popconfirm>
 | ||
|       <a-popconfirm placement="bottomRight" ok-text="Yes" cancel-text="No" @confirm="confirm">
 | ||
|         <template #title>
 | ||
|           <p>{{ text }}</p>
 | ||
|           <p>{{ text }}</p>
 | ||
|         </template>
 | ||
|         <a-button>BR</a-button>
 | ||
|       </a-popconfirm>
 | ||
|     </div>
 | ||
|   </div>
 | ||
| </template>
 | ||
| <script lang="ts" setup>
 | ||
| import { message } from 'ant-design-vue';
 | ||
| const buttonWidth = 70;
 | ||
| 
 | ||
| const text = 'Are you sure to delete this task?';
 | ||
| 
 | ||
| const confirm = () => {
 | ||
|   message.info('Clicked on Yes.');
 | ||
| };
 | ||
| </script>
 | ||
| <style scoped>
 | ||
| :deep(#components-a-popconfirm-demo-placement) .ant-btn {
 | ||
|   width: 70px;
 | ||
|   text-align: center;
 | ||
|   padding: 0;
 | ||
|   margin-right: 8px;
 | ||
|   margin-bottom: 8px;
 | ||
| }
 | ||
| </style>
 |