airyland / vux

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

tabBar的事件不触发 #1803

Closed ripeBoy closed 7 years ago

ripeBoy commented 7 years ago
<template>
  <div>
    <tabbar>
      <tabbar-item selected icon-class="iconfont icon icon-shop" link="/" on-item-click="validation" on-index-change="validation">
        <i slot="icon"></i>
        <span slot="label">商品</span>
      </tabbar-item>
      <tabbar-item icon-class="iconfont icon icon-sousuo" link="/grid" on-item-click="validation" on-index-change="validation">
        <i slot="icon"></i>
        <span slot="label">搜索</span>
      </tabbar-item>
      <tabbar-item  icon-class="iconfont icon icon-gouwuche" link="/cart" on-item-click="validation" on-index-change="validation">
        <i slot="icon"></i>
        <span slot="label">购物车</span>
      </tabbar-item>
      <tabbar-item icon-class="iconfont icon icon-wode" link="/personal" on-item-click="validation" on-index-change="validation">
        <i slot="icon"></i>
        <span slot="label">我的</span>
      </tabbar-item>
    </tabbar>
  </div>
</template>
<script type="text/ecmascript-6">
  import { Tabbar, TabbarItem, Cell } from 'vux';
export default {
  components: {
    Tabbar,
    TabbarItem,
    Cell
  },
  methods: {
    validation: function (val) {
      debugger;
      console.log(val);
    }
  }
};
</script>
<style lang="scss" scoped>
  .weui-tabbar{
    position: fixed;
  }
</style>
airyland commented 7 years ago

@on-item-click

ripeBoy commented 7 years ago

那会儿加@不行,这会儿又好了,0.0 谢谢啊

18893129924@163.com

发件人: Airyland 发送时间: 2017-08-07 17:32 收件人: airyland/vux 抄送: upright_boy; Author 主题: Re: [airyland/vux] tabBar的事件不触发 (#1803) @on-item-click — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ripeBoy commented 7 years ago

你好,可以再请教一个问题吗?就是tabBar的(on-index-change)这个事件是什么时候触发,value值改变是指的哪个值?

18893129924@163.com

发件人: Airyland 发送时间: 2017-08-07 17:32 收件人: airyland/vux 抄送: upright_boy; Author 主题: Re: [airyland/vux] tabBar的事件不触发 (#1803) @on-item-click — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

airyland commented 7 years ago

当前 tabbar-item 索引改变时,即点击切换 tabbar-item 时触发,从 0 开始。

ripeBoy commented 7 years ago

@on-index-change="validation" methods: { validation: function (val) { debugger; console.log(val); } } 这样写不对吗?事件不触发

airyland commented 7 years ago

文档这个位置错了, on-index-change 是在父组件触发的。

<tabbar @on-index-change="onIndexChange">
ripeBoy commented 7 years ago

哦哦,知道了,谢谢

ripeBoy commented 7 years ago

还想请问一下 tabBar这个组件 怎么根据路由切换tabbar-item的active状态。