Vux: tabbar组件怎么根据路由url来选中item

Created on 6 Aug 2016  ·  3Comments  ·  Source: airyland/vux

Version

"vux": "^0.1.3-rc5"

Android or iOS

iOS

<div v-cloak class="page">
    <router-view keep-alive></router-view>
    <tabbar v-if="isIndex">
      <tabbar-item :link="{name:'recommend'}">
        <i slot="icon" class="tab-icon tab-icon-recommend"></i>
        <span slot="label">推荐</span>
      </tabbar-item>
      <tabbar-item :link="{name:'raise'}">
        <i slot="icon" class="tab-icon tab-icon-kids"></i>
        <span slot="label">育儿</span>
      </tabbar-item>
      <tabbar-item :link="{name:'mine'}">
        <i slot="icon" class="tab-icon tab-icon-more"></i>
        <span slot="label">更多</span>
      </tabbar-item>
    </tabbar>
  </div>

Expected behavior and actual behavior.

每次我从二级页面回到一级页面时,tabbar默认选中第一项

Steps to reproduce the problem

componentabbar

Most helpful comment

你要是根据name来设置,就直接这样:

 <tabbar-item :selected="$route.name === 'recommend'">

All 3 comments

你要是根据name来设置,就直接这样:

 <tabbar-item :selected="$route.name === 'recommend'">

这样设置没问题。感谢

厉害

Was this page helpful?
0 / 5 - 0 ratings

Related issues

airyland picture airyland  ·  5Comments

ty850454 picture ty850454  ·  3Comments

wonghoman picture wonghoman  ·  4Comments

hao-li picture hao-li  ·  3Comments

felixjing picture felixjing  ·  4Comments