vue中点击显示隐藏

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fgg9655/article/details/78174464
写v-if判断异步数据是否加载
<div v-if="seller.supports" class="suppor-count" @click="show">
  <span class="count">{{seller.supports.length}}</span>
  <span class="icon-keyboard_arrow_right"></span>
</div>
<div v-show="detailShow" class="detail"></div>

@click="方法名"绑定click事件


script

export default { 
  props: {                  //异步数据
    seller: {
      type: Object
    }
  },
  data() {              
    return {
      detailShow: false          //默认值
    };
  },
  methods: {
    show() {
      this.detailShow = true;         //show方法
    }
  },

猜你喜欢

转载自blog.csdn.net/fgg9655/article/details/78174464