最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

uniapp幾行代碼解決滾動穿透問題(項目實戰(zhàn))

 更新時間:2023年01月11日 11:23:47   作者:夢之歸途  
這篇文章主要介紹了uniapp幾行代碼解決滾動穿透問題,本文結(jié)合實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下

具體的解決方式:

<template >
  <view class="" >
    <page-meta :page-style="spanStyle"></page-meta>
  </view>
</template>
<script >
  export default {
    data() {
      return {
        spanStyle:"overflow:auto"
      }
    },
    methods: {
      mask(data){
        //當蒙層彈起時,固定界面禁止?jié)L動,當蒙層關閉時,允許滾動
        if(data){
          this.spanStyle="overflow:hidden";
        }else{
          this.spanStyle="overflow:auto";
        }
      }
    }
  }
</script >

項目實戰(zhàn):

<template>
	<page-meta :page-style="'overflow:'+(searchPopupVisible?'hidden':'visible')" />
	
	<!--區(qū)域選擇-->
	<div class="d-toolbox cf">
		<a href="javascript:;" rel="external nofollow"  rel="external nofollow"  @click="showPopup" class="a-area" :hover="selectText!='區(qū)域'" :isOne="isOne">{{selectText}}</a>
		
		<u-popup :show="searchPopupVisible" mode="bottom" @close="searchPopupVisible = false" class="d-searchPopup cf">
			<div class="d-searchPopupBox cf">
				<strong>選擇區(qū)域</strong>
				<div v-if="resultData.length > 0">
					<!--解決滾動穿透-->
					<scroll-view scroll-y="true" style="height:100%;">
						<em v-for="(item,index) in resultData" :key="index" :class="item.region_id == region_id ? 'hover' : ''" @click="selectArea(item)">{{item.region_name}}</em>
					</scroll-view>
				</div>
				<div v-else>
					<em>暫無數(shù)據(jù)</em>
				</div>
				<a href="javascript:;" rel="external nofollow"  rel="external nofollow"  @click="searchPopupVisible = false">取消</a>
			</div>
		</u-popup>
	</div>
</template>
 
<script>
	export default {
		props: {
			region_id: {
				type: [String,Number],
				default: ''
			},
			calbackFunName: {
				type: String,
				default: 'onToolAreaCallback'
			},
		},
		data() {
			return {
				isOne : false, //是否只有一個區(qū)域
				
				selectText : '區(qū)域',
				searchPopupVisible : false,
				resultData : [],
				
			}
		},
		watch:{
			region_id(val){
				this.selectText = val == '' ? '區(qū)域' : this.resultData.find(item=>item.region_id == val).region_name
			},
		},
		mounted() {
			this.storage_authorInfo = uni.getStorageSync('storage_authorInfo') ? JSON.parse(uni.getStorageSync('storage_authorInfo')) : {};
			this.resultData = this.storage_authorInfo.Store;
			this.resultData.unshift({'region_name':'全部','region_id':''});
			//只有一個區(qū)域的特殊情況
			if(this.resultData.length === 2){
				this.isOne = true
				this.selectText = this.resultData[1].region_name
			}
			
		},
		methods: {
			showPopup(){
				if(this.isOne) return
				this.searchPopupVisible = true
			},
			selectArea(item){
				this.searchPopupVisible = false;
				this.selectText = item.region_id ? item.region_name : '區(qū)域';
				uni.$emit(this.calbackFunName , {
					region_id : item.region_id,
					region_name : item.region_name
				})
			}
		}
		
	}
</script>
 
<style lang="scss" scoped>
.d-toolbox {
	display:inline-block;
	position: relative;
	.a-area{
		font-size: 24rpx; color:#333; display: flex; align-items: center;
		&:after{
			content:'';width:24rpx; height:24rpx; background: url(/static/img/index/arrows.png) no-repeat; background-size:100%; margin-left:10rpx;
		}
		&[isOne="true"]:after{
			display:none; 
		}
		&[hover="true"]{
			color:#4568E8;
			&:after{
				background-image: url(/static/img/index/arrows-hover.png);
			}
		}
	}
}
 
.d-searchPopup{
	/deep/.u-popup__content{
		border-radius: 20rpx 20rpx 0 0; overflow: hidden;
	}
	.d-searchPopupBox{
		background: #fff;
		strong{
			display: block;
			text-align: center;
			font-size:32rpx;
			color:#333;
			height:100rpx;
			line-height: 100rpx;
			border-bottom: solid #F5F5F5 1px;
		}
		div{
			position: relative; max-height: 480rpx; overflow-y: auto;
			em , a{
				display: block;
				text-align: center;
				color:#333; font-size:28rpx;
				height:79rpx; line-height: 79rpx;
				border-bottom:solid #F5F5F5 1rpx;
				&:last-child{
					border:0;
				}
			}
			.hover{
				color:#4568E8;
			}
		}
		a{
			display: block;
			text-align: center;
			color:#333; font-size:28rpx;
			height:80rpx; line-height: 80rpx;
			border-top:solid #F5F5F5 14rpx;
		}
	}
}
 
</style>

PS:uniapp解決滾動條問題

在App.vue的style中寫上

/* 解決小程序和app滾動條的問題 */
/* #ifdef MP-NEIXIN 11 APP-PLUS */

::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}

/* #endif */
/* 解決H5的問題 */
/* #ifdef H5 */

uni-scroll-view .uni-scroll-view::webkit-scrollbar {
/* 隱藏滾動條,但依舊具備可以滾動的功能 */
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}

到此這篇關于uniapp幾行代碼解決滾動穿透問題的文章就介紹到這了,更多相關uniapp滾動穿透內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • 簡單的漸變輪播插件

    簡單的漸變輪播插件

    本文主要介紹了簡單的漸變輪播插件,具有一定的參考價值,下面跟著小編一起來看下吧
    2017-01-01
  • JavaScript制作樓層導航效果流程詳解

    JavaScript制作樓層導航效果流程詳解

    項目中遇到比較多的的文檔內(nèi)容,為了方便查找里面的小內(nèi)容,一般都會在左側(cè)或者右側(cè)放一個固定樓層的導航欄,今天就來說一下這個固定樓層導航欄的思路以及實現(xiàn)的方法
    2021-10-10
  • 前端如何計算首屏及白屏時間代碼示例

    前端如何計算首屏及白屏時間代碼示例

    白屏時間是指用戶進入該網(wǎng)站(比如刷新頁面、跳轉(zhuǎn)到新頁面等通過該方式)的時刻開始計算,一直到頁面內(nèi)容顯示出來之前的時間節(jié)點,這篇文章主要給大家介紹了關于前端如何計算首屏及白屏時間的相關資料,需要的朋友可以參考下
    2024-07-07
  • JS命名空間的另一種實現(xiàn)

    JS命名空間的另一種實現(xiàn)

    這篇文章介紹了js命名空間的另一種簡單實現(xiàn)方法,有需要的朋友可以參考一下
    2013-08-08
  • 詳述JavaScript實現(xiàn)繼承的幾種方式(推薦)

    詳述JavaScript實現(xiàn)繼承的幾種方式(推薦)

    這篇文章主要介紹了詳述JavaScript實現(xiàn)繼承的幾種方式(推薦)的相關資料,需要的朋友可以參考下
    2016-03-03
  • 深入理解Javascript箭頭函數(shù)中的this

    深入理解Javascript箭頭函數(shù)中的this

    ES6標準新增了一種新的函數(shù):Arrow Function(箭頭函數(shù))。那么下面這篇文章主要給大家介紹了箭頭函數(shù)中this的相關資料,有需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-02-02
  • js中判斷對象是否為空的三種實現(xiàn)方法

    js中判斷對象是否為空的三種實現(xiàn)方法

    本篇文章主要是對js中判斷對象是否為空的三種實現(xiàn)方法進行了詳細的分析介紹,需要的朋友可以過來參考下,希望對大家有所幫助
    2013-12-12
  • Cropper.js進階之裁剪后保存至本地實現(xiàn)示例

    Cropper.js進階之裁剪后保存至本地實現(xiàn)示例

    這篇文章主要為大家介紹了Cropper.js進階之裁剪后保存至本地實現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-05-05
  • JS組件系列之Bootstrap Icon圖標選擇組件

    JS組件系列之Bootstrap Icon圖標選擇組件

    這篇文章給大家介紹js組件系列之Bootstrap Icon圖標選擇組件,對bootstrap icon圖標相關知識感興趣的朋友一起學習吧
    2016-01-01
  • DWR3 訪問WEB元素的兩種方法實例詳解

    DWR3 訪問WEB元素的兩種方法實例詳解

    這篇文章主要介紹了DWR3 訪問WEB元素的兩種方法實例詳解的相關資料,需要的朋友可以參考下
    2017-01-01

最新評論

禹州市| 肃北| 常州市| 柳州市| 渝北区| 驻马店市| 天津市| 石门县| 邵武市| 大丰市| 内丘县| 新野县| 厦门市| 沾化县| 阳春市| 仲巴县| 屯门区| 南和县| 固原市| 东丽区| 宣武区| 上饶县| 宁陵县| 五台县| 南通市| 精河县| 陆丰市| 体育| 昌黎县| 伊春市| 易门县| 英超| 上犹县| 密云县| 旌德县| 湘西| 探索| 隆尧县| 城固县| 白山市| 霍城县|