Vue @click.native not working?

大城市里の小女人 提交于 2019-12-04 09:06:12
  1. The .native modifier is not necessary on native elements - it can only be used on component elements. Remove it.

  2. It seems you want to change data in the root component. Your current code changes data in the navigation component.

Two ways to do this:

1) The clean way:

In the navigation component, we emit an event with the new value to the parent:

<a href="#" @click="$emit('current-view', 'youtube')">

in the parent (here, the root) component, we receive the event and set the value:

<navigation @current-view="currentView = $event"></navigation>

2) The hacky way:

<a href="#" @click="$root.currentView='youtube'">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!