45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Vue
		
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Vue
		
	
	
| <docs>
 | ||
| ---
 | ||
| order: 7
 | ||
| title:
 | ||
|   zh-CN: ่ๅ้่ๆนๅผ
 | ||
|   en-US: The way of hiding menu.
 | ||
| ---
 | ||
| 
 | ||
| ## zh-CN
 | ||
| 
 | ||
| ้ป่ฎคๆฏ็นๅปๅ
ณ้ญ่ๅ๏ผๅฏไปฅๅ
ณ้ญๆญคๅ่ฝใ
 | ||
| 
 | ||
| ## en-US
 | ||
| 
 | ||
| The default is to close the menu when you click on menu items, this feature can be turned off.
 | ||
| 
 | ||
| </docs>
 | ||
| 
 | ||
| <template>
 | ||
|   <a-dropdown v-model:open="visible">
 | ||
|     <a class="ant-dropdown-link" @click.prevent>
 | ||
|       Hover me
 | ||
|       <DownOutlined />
 | ||
|     </a>
 | ||
|     <template #overlay>
 | ||
|       <a-menu @click="handleMenuClick">
 | ||
|         <a-menu-item key="1">Clicking me will not close the menu.</a-menu-item>
 | ||
|         <a-menu-item key="2">Clicking me will not close the menu also.</a-menu-item>
 | ||
|         <a-menu-item key="3">Clicking me will close the menu</a-menu-item>
 | ||
|       </a-menu>
 | ||
|     </template>
 | ||
|   </a-dropdown>
 | ||
| </template>
 | ||
| <script lang="ts" setup>
 | ||
| import { ref } from 'vue';
 | ||
| import { DownOutlined } from '@ant-design/icons-vue';
 | ||
| import type { MenuProps } from 'ant-design-vue';
 | ||
| const visible = ref(false);
 | ||
| const handleMenuClick: MenuProps['onClick'] = e => {
 | ||
|   if (e.key === '3') {
 | ||
|     visible.value = false;
 | ||
|   }
 | ||
| };
 | ||
| </script>
 |