Skip to content

Commit

Permalink
fix(menu): do not eagerly access $router in rendering
Browse files Browse the repository at this point in the history
corresponding to: #4718
  • Loading branch information
dsh0416 authored Nov 10, 2024
1 parent af68adb commit d82a823
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/menu/menu-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,12 @@ export default defineComponent({
},
},
render() {
const router = this.router || this.$router;

const liContent = (
<li ref="itemRef" class={this.classes} onClick={this.handleClick}>
{renderTNodeJSX(this, 'icon')}
{this.routerLink ? (
<a
href={this.href ? this.href : this.to ? router?.resolve(this.to).href : ''}
href={this.href ? this.href : this.to ? (this.router || this.$router)?.resolve(this.to).href : ''}
target={this.target}
class={`${this.classPrefix}-menu__item-link`}
onClick={(e) => e.preventDefault()}
Expand Down

0 comments on commit d82a823

Please sign in to comment.