web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. seo教程
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站

van-collapse-item折叠面板判断,有内容显示箭头可点击

147 ℃
     

Collapse, CollapseItem组件van-collapse-item折叠面板进行判断,如果有内容显示箭头可点击,否则箭头不显示!

具体实现代码如下:

<template>  
  <van-collapse v-model="activeNames">  
    <van-collapse-item  
      v-for="(item, index) in items"  
      :key="index"  
      :title="item.title"  
      :name="`item-${index}`"  
      :clickable="item.hasContent"  
    >  
      <div v-if="item.hasContent">  
        <!-- 内容区域 -->  
        {{ item.content }}  
      </div>  
      <!-- 使用 slot 自定义标题,包括箭头 -->  
      <template #title>  
        <div class="custom-title">  
          {{ item.title }}  
          <van-icon  
            v-if="item.hasContent"  
            class="arrow"  
            name="arrow-right"  
          />  
        </div>  
      </template>  
    </van-collapse-item>  
  </van-collapse>  
</template>  
  
<script>  
export default {  
  data() {  
    return {  
      activeNames: [], // 控制折叠面板的展开和收起  
      items: [  
        { title: '标题1', content: '内容1', hasContent: true },  
        { title: '标题2', content: '', hasContent: false }, // 没有内容  
        // ... 其他条目  
      ],  
    };  
  },  
};  
</script>  
  
<style scoped>  
.custom-title {  
  display: flex;  
  justify-content: space-between;  
  align-items: center;  
}  
  
.arrow {  
  // 箭头的样式  
}  
</style>

移动端vant组件input框点击时如何禁止弹出手机键盘

Vant4是一个轻量级可靠的移动Vue组件库

van-picker选择器没有取消/确认按钮和标题解决方法!

vuejs安装Vant有赞移动端组件库

标签: Vant, Vant组件, 折叠面板

上面是“van-collapse-item折叠面板判断,有内容显示箭头可点击”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_14465.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > vuejs
本文共计820个字,预计阅读时长6分钟
生活小工具,收录了80多款小工具
上一篇: 基于JavaScrip的web动画库——GSAP
下一篇: 免费商用中文字体——优设鲨鱼菲特健康体
x 打工人ai神器