v-on:click on a mdb-nav-item


Topic: v-on:click on a mdb-nav-item

cawgit asked 5 years ago

Expected behavior

Fire a function on a click event of an mdb-nav-item. Does not work...

Actual behavior

I have a login button on my primary App.vue file that when click I need it to log the user into Azure AD. I cannot seem to come up with the correct combination to actually fire a method on the click event. Below is the item code.

Resources (screenshots, code snippets etc.)

<mdb-nav-item v-on:click="login()" waves-fixed>Login</mdb-nav-item>


Magdalena Dembna staff premium answered 5 years ago

Hi, Unfortunately, this component doesn't emit click event and that's why it's not working as you've expected it to work. We use it with href / to properties depending on needs. All I can suggest right now is nesting a button and adding a click event there. I'm sorry for this inconvenience. Best regards, Magdalena


paddek answered 5 years ago

Have you tried v-on:click.native="login()"?


Magdalena Dembna staff premium commented 5 years ago

I'm afraid this solution won't work in this example - our component should've emit 'click' event in the click-handler method defined inside the component (it's responsible for the waves effect). We will consider adding this functionality in one of future releases. Kind regards, Magdalena


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 5.3.0
  • Device: Desktop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No