airyland / vux

Mobile UI Components based on Vue & WeUI
https://vux.li
MIT License
17.59k stars 3.71k forks source link

Tabbar组件报错 #1316

Closed fguizc closed 7 years ago

fguizc commented 7 years ago

版本: "vux": "^2.2.1" 在tmplate中调用

    <view-box ref="viewBox">
     <XHeader 
      title="xxx" 
      :left-options="{showBack: false}" 
      slot="header" 
      style="width:100%;position:absolute;left:0;top:0;z-index:100;" 
     />
     <div slot="body-padding-bottom"></div>
     <transition name="slide-fade" mode="out-in">
     <router-view></router-view>
     </transition>
     <tabbar slot="bottom">
     <router-link to="/" exact>
      <tabbar-item>
        <icon name="egg" slot="icon" scale="2.7" />
        <span slot="label">首页</span>
      </tabbar-item>
     </router-link>
     <router-link to="/hello">
      <tabbar-item>
        <icon name="creative" slot="icon" scale="2.7"></icon>
        <span slot="label">发现</span>
      </tabbar-item>
     </router-link>
     <router-link to="/userinfo">
      <tabbar-item link="/userinfo">
        <icon name="people" slot="icon" scale="2.7"></icon>
        <span slot="label">我</span>
      </tabbar-item>
     </router-link>
    </tabbar>
   </view-box>
</template>

已引用并注册相关的组件

刷新页面就报警告

vue.esm.js?65d7:558 [Vue warn]: Error in mounted hook: (found in at E:\Graduation_Project\read_onlie_project\node_modules\vux\src\components\tabbar\tabbar-item.vue)

以及

vue.esm.js?65d7:1447 TypeError: this.$parent.updateIndex is not a function

在ISSUESS中找到一个已关闭的,按照其中操作重新引入依旧报警告,同时卸载重新安装包也无效

airyland commented 7 years ago

不要使用 router-link 包裹 tabbar-item。tabbar-item 已经支持了 link 属性。