Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0492be9

Browse filesBrowse files
committed
fix: CDropdownItem: fix closing dropdown when item is router link coreui#79
1 parent 4c29500 commit 0492be9
Copy full SHA for 0492be9

File tree

1 file changed

+22
-13
lines changed
Filter options

1 file changed

+22
-13
lines changed

‎src/components/dropdown/CDropdownItem.vue

Copy file name to clipboardExpand all lines: src/components/dropdown/CDropdownItem.vue
+22-13Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,30 @@ export default {
55
name: 'CDropdownItem',
66
props: propsFactory(),
77
render (h) {
8+
const data = {
9+
props: this._props,
10+
staticClass: 'dropdown-item',
11+
attrs: { role: 'menuitem' },
12+
on: {
13+
//listeners added, due to component was previously functional for compatibility
14+
...this.$listeners,
15+
click: (e) => {
16+
this.$parent.$emit('dropdown-close')
17+
this.$emit('click', e)
18+
}
19+
}
20+
}
21+
if (this.to) {
22+
data.nativeOn = {
23+
click: (e) => {
24+
this.$parent.$emit('dropdown-close')
25+
this.$emit('click', e)
26+
}
27+
}
28+
}
829
return h(
930
CLink,
10-
{
11-
props: this._props,
12-
staticClass: 'dropdown-item',
13-
attrs: { role: 'menuitem' },
14-
on: {
15-
//listeners added, due to component was previously functional for compatibility
16-
...this.$listeners,
17-
click: (e) => {
18-
this.$parent.$emit('dropdown-close')
19-
this.$emit('click', e)
20-
}
21-
}
22-
},
31+
data,
2332
this.$slots.default
2433
)
2534
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.