vue 实现显示与隐藏

vue 实现显示与隐藏

// An highlighted block
<template>
  <div>
    <header-top>
      <span slot="title" class="name">版本更新</span>
    </header-top>
    <div class="h_con">
        <div class="h_question">
            <div v-for="(item,index) in questList" :key="index">
              <div class="h_ques"  @click="toggle(item)">{{item.title}}
                <span style="float:right;" v-if="item.show"><img src="../images/back.png" alt="" class="s_img"></span>
                <span style="float:right" v-else><img src="../images/left.png" alt=""  class="s_img1"></span>
              </div>
              <div class="h_answer" v-show="show">
                {{item.article}}
              </div>
            </div>
        </div>
    </div>
  </div>
</template>
<script>
import { get_version} from "@/api/chttp.js";
import HeaderTop from "@/components/HeaderTop";
import Vue from "vue";
import { Toast } from "vant";
Vue.use(Toast);
export default {
  name: "Version",
  data() {
    return {
      show:false,
      questList:[
          {title:'2.0.0版本功能介绍',article:'可以实现群聊、发送名片、交换名片、保存到通讯录等功能',show:false},
          {title:'1.0.0版本功能介绍',article:'可以实现群聊、保存到通讯录等功能',show:false},
      ]
    };
  },
  components: {
    HeaderTop
  },
  mounted (){
  this.get_questList();
  },
  methods: {
    toggle(item) {
      // this.show = !this.show;
      if (item.article.length != 0) {
        item.show = !item.show;
      } else {
        item.show = item.show;
      }
    },
     get_questList(){
      const params = {
        type:1
      };
      get_version(params).then(res => {
        this.questList = res.data.data;
      });
    }
  }
};
</script>
<style scoped lang="stylus">
.h_con
    margin-top 105px
    .h_question
        font-size 28px
        .h_ques
            color #656565
            padding 0px 20px
            line-height 100px
            // border-bottom 2px solid #efeff5
            border-top 2px solid #efeff5
            .s_img
              width 28px
              height 20px
            .s_img1
              width 20px
              height 28px
        .h_answer
            color #656565
            padding 20px
            line-height 35px
            background-color #f5f5f5

</style>
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值