close n-dropdown programmitically? #3549
-
I'm using n-dropdown with render feature, the code is like this: // when not logged in, render an n-button
options.push({
key: 'login',
type: 'render',
render: () => h(NButton, {
class: 'titlebar-dropdown-link',
onClick: () => {
util.jumpToPage('special:login?returnto=social', '_blank', 'club')
},
text: true
},
['登录'])
})
// when logged in, render a router-link
options.push({
key: 'mypage',
type: 'render',
render: () => h(RouterLink,
{
class: 'titlebar-dropdown-link',
to: {
name: 'user',
params: {
userid: store.currentUser.profile?.id
}
}
},
['我的空间']
)
}) the route jumps fine, but I have to click outside to close the dropdown. is there anyway to close the dropdown programmatically? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
We should expose |
Beta Was this translation helpful? Give feedback.
-
Also, it seems like |
Beta Was this translation helpful? Give feedback.
-
I am now using |
Beta Was this translation helpful? Give feedback.
We should expose
setShow
method (I'll add it in next version)