淺談VUE uni-app 基礎(chǔ)組件
1 .scroll-view
使用豎向滾動時(shí),需要給 一個固定高度,通過 css 設(shè)置 height;使用橫向滾動時(shí),需要給添加white-space: nowrap;樣式。
scroll-y:允許縱向滾動,scroll-x:允許橫向滾動
@scroll: 滾動時(shí)觸發(fā),event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY}
數(shù)據(jù)雙向綁定
<template>
<view>
<scroll-view class="scroll" scroll-y="true" @scroll="scroll">
<view v-for="i in 100">{{i}}</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
flag:true
}
},
methods: {
scroll(e){
console.log(e.detail);
}
}
}
</script>
<style>
.scroll{
height:400rpx;
}
</style>
總結(jié)
本篇文章就到這里了,希望能夠給你帶來幫助,也希望您能夠多多關(guān)注腳本之家的更多內(nèi)容!
相關(guān)文章
vue3使用iframe嵌入ureport2設(shè)計(jì)器,解決預(yù)覽時(shí)NullPointerException異常問題
這篇文章主要介紹了vue3使用iframe嵌入ureport2設(shè)計(jì)器,解決預(yù)覽時(shí)NullPointerException異常問題,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-10-10
解決vue組件中使用v-for出現(xiàn)告警問題及v for指令介紹
這篇文章主要介紹了解決vue組件中使用v-for出現(xiàn)告警問題,在文中給大家介紹了v for指令,需要的朋友可以參考下2017-11-11
vue element實(shí)現(xiàn)表格合并行數(shù)據(jù)
這篇文章主要為大家詳細(xì)介紹了vue element實(shí)現(xiàn)表格合并行數(shù)據(jù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-11-11
Vue中this.$refs獲取為undefined的原因和解決辦法(this.$refs.屬性為undefined原因
在Vue項(xiàng)目開發(fā)中,使用this.$refs訪問組件或DOM元素的引用時(shí),可能會遇到獲取為undefined的情況,這篇文章主要介紹了Vue中this.$refs獲取為undefined的原因和解決辦法,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-11-11

