Skip to content

DropCard 滑走式卡片

支持平台

安卓iosweb微信小程序支付宝小程序QQ小程序
xxx

示例

html
<template>
	<t-page title="卡片" class="p.30-ov">
		<t-card class="mb.30" title="DropCard 滑走式卡片"
			sub-title="滑走式卡片是一种堆叠卡片布局,支持卡片之间的间隔、缩放效果以及动态初始化和样式设置,通过简单的属性配置即可实现层次分明、视觉上具有深度感的卡片滑走动画效果。"></t-card>
		<view style="padding-top: 10rpx;overflow: visible;flex-direction: column;align-items: center;">
			<t-drop-card width="600rpx" height="400rpx" space="38rpx">
				<t-drop-card-item v-for="(item,index) in cardList1" :key="index" style="overflow: hidden;">
					<image :src="item" style="width: 100%;height: 100%;"></image>
				</t-drop-card-item>
			</t-drop-card>
		</view>
		<view style="height: 80rpx;"></view>
		<view style="display: flex;overflow: visible;flex-direction: column;align-items: center;">
			<t-drop-card width="500rpx" height="700rpx" space="38rpx">
				<t-drop-card-item v-for="(item,index) in cardList" :key="`dropcard${index}`" @left="left" @right="right"
					@center="center">
					<image :src="item" style="width: 100%;height: 100%;"></image>
				</t-drop-card-item>
			</t-drop-card>
		</view>
	</t-page>
</template>
<script lang="uts">
	export default {
		data() {
			return {
				cardList: [
					'/static/image/Z1.jpg',
					'/static/image/Z2.jpg',
					'/static/image/Z3.jpg',
					'/static/image/Z4.jpg',
					'/static/image/Z5.jpg'
				] as string[],
				cardList1: [
					'/static/image/D1.jpg',
					'/static/image/D2.jpg',
					'/static/image/D3.jpg',
					'/static/image/D4.jpg'
				] as string[]
			}
		},
		methods: {
			left() {
				console.log('left')
			},
			right() {
				console.log('right')
			},
			center() {
				console.log('center')
			}
		}
	}
</script>
<style>
	.root {
		flex: 1;
		padding: 20rpx;
		overflow: visible;
	}
</style>

Props

名称描述类型默认值可选值
width容器宽String700rpx
height容器高String750rpx
space每层之前TOP值的差值String30rpx
scaleNumber后面层级的缩放倍率Number0.05