zoukankan      html  css  js  c++  java
  • uniapp 吸顶 小demo

    <template>
    	<view class="page-box">
    		<uniStatusBar class="status"></uniStatusBar>
    		<uniStatusBar></uniStatusBar>
    		<view style="height:200px">滚动试试</view>
    		<view class="box1" :style="{ top: statusBarHeight }">box1</view>
    		<view class="box2">box2</view>
    		<view style="height:200px"></view>
    	</view>
    </template>
    
    <script>
    	var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';//uniapp获取手机状态栏的高度
    	export default {
    		data() {
    			return {
    				statusBarHeight: statusBarHeight
    			};
    		},
    	}
    </script>
    
    <style scoped>
    	.page-box{
    		height: 1000px;
    	}
    	.status{
    		position: fixed;
    		top: 0;
    		left: 0;
    		z-index: 999;
    		background: #FFFFFF;
    	}
    	.box1 {
    	  position: -webkit-sticky;
    	  position: sticky;
    	   100%;
    	  height: 30px;
    	  text-align: center;
    	  color: #fff;
    	  margin-bottom: 50px;
    	  z-index: 1;
    	  background: #007bff;
    	}
    	
    	
    	.box2 {
    	  background: #f4516c;
    	   100%;
    	  height: 30px;
    	  text-align: center;
    	}
    </style>
    

      

  • 相关阅读:
    搜索引擎
    Mybatis springmvc面试题
    spring框架面试题
    数据库
    javaWEB面试题
    JavaWeb
    SpringCloud2
    网络
    比特币网络架构及节点发现分析
    Github推荐一个国内牛人开发的超轻量级通用人脸检测模型
  • 原文地址:https://www.cnblogs.com/fanqiuzhuji/p/12516067.html
Copyright © 2011-2022 走看看