# 手动定位
在特殊情况下,你可能想手动定位下拉菜单。比如在一块区域右击以弹出下拉菜单。
```html
右击
```
```js
const options = [
{
label: '杰·盖茨比',
value: 'jay gatsby'
},
{
label: '黛西·布坎南',
value: 'daisy buchanan'
},
{
type: 'divider'
},
{
label: '尼克·卡拉威',
value: 'nick carraway'
},
{
label: '其他',
value: 'others',
children: [
{
label: '乔丹·贝克',
value: 'jordan baker'
},
{
label: '汤姆·布坎南',
value: 'tom buchanan'
},
{
label: '其他',
value: 'others',
children: [
{
label: '鸡肉',
value: 'chicken'
},
{
label: '牛肉',
value: 'beef'
}
]
}
]
}
]
export default {
methods: {
handleSelect (name) {
this.showDropdown = false
this.$NMessage.info(name)
},
handleBlur () {
this.showDropdown = false
},
handleContextMenu (e) {
e.preventDefault()
this.showDropdown = false
this.$nextTick().then(() => {
this.showDropdown = true
this.x = e.clientX
this.y = e.clientY
})
}
},
data () {
return {
options,
showDropdown: false,
x: 0,
y: 0
}
}
}
```