Skip to content

t-drop-card-item

DropCardItem 下拉卡片项

组件介绍

滑走式卡片子组件,与t-drop-card组件配合使用,用于实现堆叠卡片的滑走效果,支持触摸交互和动画效果。

平台兼容

HarmonyH5AndroidiOS小程序UTS

基础用法

vue
<template>
  <t-drop-card :space="'30rpx'" :scaleNumber="0.05">
    <t-drop-card-item v-for="(item, index) in cardList" :key="index">
      <t-view class="card-item">
        <t-text class="card-title">{{ item.title }}</t-text>
        <t-text class="card-content">{{ item.content }}</t-text>
      </t-view>
    </t-drop-card-item>
  </t-drop-card>
</template>

<script setup>
const cardList = ref([
  { title: '卡片 1', content: '这是第一张卡片的内容' },
  { title: '卡片 2', content: '这是第二张卡片的内容' },
  { title: '卡片 3', content: '这是第三张卡片的内容' }
]);
</script>

<style scoped>
.card-item {
  width: 100%;
  height: 300rpx;
  padding: 30rpx;
  box-sizing: border-box;
  background-color: #fff;
  border-radius: 10rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
}

.card-title {
  font-size: 32rpx;
  font-weight: bold;
  margin-bottom: 20rpx;
}

.card-content {
  font-size: 28rpx;
  color: #666;
}
</style>

Props

属性名类型默认值说明可选值
sizeString""组件尺寸large, medium, small, mini
typeString""组件类型info, primary, error, warning, success
disabledBooleanfalse组件是否禁用true, false
hoverBooleanfalse是否有点击效果true, false
pathString""点击组件后跳转的页面路径-
effectString""组件显示主题normal, dark, light, plain

Events

事件名说明回调参数
click点击时触发-
transitionend动画结束时触发-
touchstart触摸开始时触发触摸事件对象
touchend触摸结束时触发触摸事件对象
touchmove触摸移动时触发触摸事件对象
touchcancel触摸取消时触发触摸事件对象

Slots

插槽名说明
default卡片内容插槽,用于放置卡片的具体内容