uni-app中uni-card实现滚动内容:uni-scroll-view组件使用教程
<template>
<view class='content'>
<uni-card>
<uni-scroll-view class='scroll-view' scroll-y>
<view class='scroll-content'>
<!-- 需要滚动的内容 -->
</view>
</uni-scroll-view>
</uni-card>
</view>
</template>
<style>
.content {
height: 100%;
padding: 20rpx;
}
.scroll-view {
height: 300rpx;
}
.scroll-content {
height: 600rpx;
}
</style>
<p>在上述示例中,uni-scroll-view组件设置了scroll-y属性,表示垂直方向可以滚动。同时,设置了固定高度的父容器和子容器,使得内容超出高度后可以滚动。</p>
原文地址: https://www.cveoy.top/t/topic/m5Lw 著作权归作者所有。请勿转载和采集!