vue同个按钮控制展开和折叠同个事件

          <el-button :icon="!moreshow?'el-icon-arrow-down':'el-icon-arrow-up'" @click="getmoreshow">{{!moreshow?更多:隐藏}}</el-button>

data() {
      return {
        moreshow:false,
        count:1,
     }
}
mounted() {
      this.getmoreshow()//避免点击两次才生效
},
methods: {
      getmoreshow(){
        if(this.count%2==0){
          this.moreshow=true
        }else{
          this.moreshow=false
        }
        this.count++
      },
}
发布了55 篇原创文章 · 获赞 4 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_44770377/article/details/104573883
今日推荐