当前位置:网站首页>当uniapp遇上滚动穿透,巧妙的解决方式~
当uniapp遇上滚动穿透,巧妙的解决方式~
2022-04-21 09:28:00 【一粒程序米】
上一次遇上这个滚动穿透,我是暴力解决的,当uniapp遇上可恶的滚动穿透的时候,我是怎么暴力解决的,今天学会了一个巧妙的方式,几行代码,超级方便好用,爱了爱了…
就是利用page-meta标签的page-style属性!
page-meta 的page-style属性相当于HTML的body属性,这个点很重要,之前我想要通过body{overflow:hidden;}的方式动态修改overflow的属性去停止页面的滚动,但是那时不知道怎么动态修改body的属性,而且如果使用document的方式去修改body的属性,在移动端真机会报错,拿不到body,真的很头疼,直到让我发现了page-style,实在是太好用了!!!
具体的解决方式:
<template >
<view class="" >
<page-meta :page-style="spanStyle"></page-meta>
</view>
</template>
<script >
export default {
data() {
return {
spanStyle:"position:auto"
}
},
methods: {
mask(data){
//当蒙层弹起时,固定界面禁止滚动,当蒙层关闭时,允许滚动
if(data){
this.spanStyle="position:fixed";
}else{
this.spanStyle="position:auto";
}
}
}
}
</script>
这方法爱了爱了…
也许是我懂得太少了,加油鸭!
版权声明
本文为[一粒程序米]所创,转载请带上原文链接,感谢
https://wangjinchan.blog.csdn.net/article/details/124265267
边栏推荐
- 笔记0104. MySQL 高级 - 索引 - 概述
- 1167: number of reversals (pointer topic)
- Open3d reads and writes ply point cloud files
- Detailed explanation of native and H5 mixed development
- Penetration test - get the system fofa keyword to brush the hole
- 1169: 大整数(指针专题)
- Handler asynchronous message passing mechanism (I) common basic usage of handler
- 【CVPR 2020】PointASNL :Robust Point Clouds Processing using Nonlocal Neural Networks
- Open3d读写pcd点云文件
- Handler异步消息传递机制(一)Handler常用基本用法
猜你喜欢

Opencv -- separate color channel, image contrast, brightness adjustment, discrete Fourier transform (10)

Actual combat penetration - fofa dirbrute - code audit - construction POC ueditor - decryption - WAF Godzilla

PageRank-案例-机场

Penetration practice - dig a school site vulnerability (APP vulnerability)

Netease blog is going to be closed. My article!

CC00019.CloudJenkins—————————————

Pys1: Overview

Penetration test - get the system fofa keyword to brush the hole

【ACM】131. 分割回文串

PyS1:概述
随机推荐
【栈和队列】C语言简单应用 ⌊栈和队列互相实现,循环队列⌉
2022年主要的编程语言及应用
Open3d reads and writes ply point cloud files
I use ehcache local cache to improve the query performance by 100 times. It's really fragrant!
笔记0104. MySQL 高级 - 索引 - 概述
1146: 吃糖果
CC00000.CloudJenkins—————————————
1166: 实数取整(指针专题)
计算器(力扣)
Download the first analysis report on China's database industry!
[appium] use the simulator to realize the business functions of Youdao cloud app - add, search, modify and delete
1166: rounding of real numbers (pointer topic)
Redisson简介和整合
Open3d reads and writes PCD point cloud files
Kali:sqlmap :[10:39:37] [CRITICAL] unable to connect to the target URL
The database has a table in which JSON data is stored in one field. I need to parse this string when this table is updated, and then update the parsed JSON data to another table. What are the good sug
Handler异步消息传递机制(一)Handler常用基本用法
Major programming languages and applications in 2022
Multithreaded copy set (New 4)
Multithreaded small copy set (New Edition 2)