码迷,mamicode.com
首页 > 其他好文 > 详细

vant的tab选项卡的点击事件传参

时间:2020-07-20 17:16:19      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:ant   tor   事件   传参   list   tab   tick   als   选项卡   

1、在van-tabs上绑定点击事件(getQuestionByTypeid2)

<van-tab title="热榜">
        <div id="hot-list-title">
          <van-tabs
            v-model="typeid"
            sticky
            offset-top="43"
            @click="getQuestionByTypeid2"
          >
            <van-tab
              v-for="item in TypeNameList"
              :title="item.name"
              :name="item.typeid"   //不写就默认为索引下标
              :key="item.typeid"
            >
              <van-grid :column-num="1" :center="false">
                <van-grid-item
                  v-for="(item2, index) in QuestionListByTypeid"
                  :key="index"
                  class="r-q-content"
                >
                  <nuxt-link
                    v-on:click.stop="doThis"
                    :to="
                      `question?id=${item2.questionid}&redirectUrl=%2Fres061401%2Fycc%2Fshop%2Fmobile%2Fquestion%3Fid%3D181${item2.questionid}`
                    "
                  >
                    <div class="r-q-title">
                      {{ item2.title }}
                    </div>
                  </nuxt-link>
                  <div
                    v-html="item2.content"
                    class="q-desc fr-element fr-view"
                  ></div>
                  <div style="color: #999;">
                    <span>{{ item2.answerCount }}&nbsp;热度</span>
                  </div>
                </van-grid-item>
              </van-grid>
            </van-tab>
          </van-tabs>
        </div>
      </van-tab>
 
2、方法
getQuestionByTypeid2(tid, title) {
      window.sessionStorage.setItem(‘Tid‘, title)
      console.log(tid) //默认是点击该选项的下标,但是在上面已经给绑定更改name了这里就不会是默认的了 绑定什么值传来就是什么值(item.typeid)
      console.log(title) 
      this.getQuestionByTypeid()
    }
 

vant的tab选项卡的点击事件传参

标签:ant   tor   事件   传参   list   tab   tick   als   选项卡   

原文地址:https://www.cnblogs.com/chenshaoxiong/p/13345978.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!