微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

uniapp 头部 底部固定 中间滑动

<template>
	<view class="scrool-page" ref='xx'>
		<view class="header-cont">头部</view>
		<view class="list-cont">
			<scroll-view class="scrool-more" style="height: 100%" scroll-y="true" scroll-with-animation="true">
				<view lass="list" v-for="(item,index) in list" :key="index">
					{{item.cont}}
				</view>
			</scroll-view>
		</view>

		<view class="footer">
			<button type="primary">提交</button>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},

					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},

					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},

					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},

					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},

					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},

					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三"
					},
					{
						cont: "张三=="
					},
				]
			}
		},
		mounted() {
			console.log(this.$refs.xx.$parent.$el.clientHeight);
			console.log(this.$refs.xx.$el.style)
			this.$refs.xx.$el.style.height = this.$refs.xx.$parent.$parent.$el.clientHeight + 'px'
		}
	}
</script>

<style lang="less">
	page {
		width: 100%;
		height: 100%;
	}


	.scrool-page {
		display: flex;
		flex-direction: column;
		width: 100%;
		height: 100%;
	}

	.header-cont {
		width: 100%;
		height: 110rpx;
		line-height: 100rpx;
		text-align: center;
		background: red;
	}

	.list-cont {
		flex: 1;
		position: relative;

		.scrool-more {
			position: absolute;
			left: 0;
			right: 0;
			top: 0;
			bottom: 0;
		}

		.list {
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			background: #e0e0e0;

		}
	}


	.footer {
		color: #fff;
		line-height: 100rpx;
		flex: 0 0 100rpx;
		/* 不放大不缩小固定100rpx */
	}

	body,
	html {
		-webkit-user-select: none;
		user-select: none;
		width: 100%;
		height: 100%;
	}
</style>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐