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>
    

      

  • 相关阅读:
    SpringSecurity开发
    SpringBoot 集成Spring Security
    Hexo
    gitbook使用
    Maze
    Party
    A. DZY Loves Chessboard
    1042B. Vitamins
    Petr and a Combination Lock
    433B.Kuriyama Mirai's Stones
  • 原文地址:https://www.cnblogs.com/fanqiuzhuji/p/12516067.html
Copyright © 2011-2022 走看看