欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Vue2.0 實(shí)現(xiàn)單選互斥的方法

 更新時(shí)間:2018年04月13日 09:21:48   作者:懶惰的小白  
本篇文章主要介紹了Vue2.0 實(shí)現(xiàn)單選互斥的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

本文介紹了Vue2.0 實(shí)現(xiàn)單選互斥的方法,分享給大家,具體如下:

需要實(shí)現(xiàn)如上圖的功能

1. 首次加載頁面,根據(jù)data里的catgoryId高亮對應(yīng)的選項(xiàng)
2. 點(diǎn)擊某個(gè)選項(xiàng),該選項(xiàng)高亮,其他去掉高亮

代碼結(jié)構(gòu):

<template> 
  <dd @click="changeCategory(currCourseFirst.categoryId)" 
        v-for="currCourseFirst in currCourse.currCourseFirst" 
        :key="currCourseFirst.categoryId" 
        :class="resultCategoryId === currCourseFirst.categoryId ? 'active': ''" >
          {{currCourseFirst.name}}
  </dd>
</template>

<script>
  export default{
    data() {
      return {
        categeryId: this.$route.query.categoryId,
        typeId: this.$route.query.typeId
      }
    },
    methods: {
      changeCategoryId(categoryId) {
        this.categoryId = categoryId
      }
    },
    computed: {
      resultCategoryId(){
        return this.categoryId
      }
    }
  }
</script>

自我理解

參考鏈接:http://www.dbjr.com.cn/article/138185.htm

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論