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工作流
一只黑色的小猫在童话森林里嗅着一朵发光的外星花
一只处于战斗状态下的蚂蚁ComfyUI工作流
一只黑色章鱼ComfyUI工作流
《翅膀之王:鸡的团契》海报ComfyUI工作流
迷人的月光,发光的花朵
一只千纸鹤坐在路上哭泣ComfyUI工作流
1个黑发带着耳机项链的女孩ComfyUI工作流
一个冰淇淋ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

利用html5+css3实现滚雪球效果(附代码)
利用CSS3代码编写45款按钮效果
一个包含老黄历、佛历、道历、星宿等数据的日历网站
用canvas实现画板涂鸦效果
js实现table表格动态新增行和列表
jquery鼠标滑过图片边框特效(jquery.focus-follow插件)
用svg画出游泳池动画效果
canvas黑洞漩涡(canvas+js)







