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

创建于 2016-08-06  ·  3评论  ·  资料来源: 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

最有用的评论

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

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

所有3条评论

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

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

这样设置没问题。感谢

厉害

此页面是否有帮助?
0 / 5 - 0 等级