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>
van-picker选择器没有取消/确认按钮和标题解决方法!
上面是“van-collapse-item折叠面板判断,有内容显示箭头可点击”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_14465.html
workflows工作流
Latent放大comfyui工作流
一只白色小猫comfyui工作流
一杯咖啡蒸汽形成云ComfyUI工作流
一名男子跪在月球岩石表面看见小行星碰撞
一桌精致的美食,桌上几杯白葡萄酒
树上挂着一只快乐的荔枝ComfyUI工作流
一只放屁虫甲虫ComfyUI工作流
森林里一只空灵的犀鸟ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

css3实现星球旋转
如何利用svg做一个有趣的loading动画加载
纯html+css做一个3d统计效果
利用css绘画棋盘布局(象棋)
3d文字360度旋转
javascript如何利用draggable实现一个拖拽效果
数字滚动效果(兼容IE6/IE8)










