You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
904 B
56 lines
904 B
4 weeks ago
|
<template>
|
||
|
<view class="my-container">
|
||
|
<view class="inner-container">
|
||
|
<slot></slot>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
name: 'myContainer',
|
||
|
data() {
|
||
|
return {
|
||
|
time: ''
|
||
|
};
|
||
|
},
|
||
|
mounted() {},
|
||
|
|
||
|
methods: {
|
||
|
//处理滚动
|
||
|
handleScroll() {
|
||
|
const time = Date.now();
|
||
|
if (time - this.time > 100) {
|
||
|
this.time = time;
|
||
|
uni
|
||
|
.createSelectorQuery()
|
||
|
.in(this)
|
||
|
.select('.inner-container')
|
||
|
.boundingClientRect((rect) => {
|
||
|
console.log(rect);
|
||
|
// this.$store.commit('category/setCategoryShow', rect.top < 100);
|
||
|
})
|
||
|
.exec();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss">
|
||
|
.my-container {
|
||
|
height: 100vh;
|
||
|
width: 100vw;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
.inner-container {
|
||
|
width: 90%;
|
||
|
height: 90%;
|
||
|
border-radius: 6px;
|
||
|
background-color: #ffffff3b;
|
||
|
backdrop-filter: blur(10px);
|
||
|
}
|
||
|
}
|
||
|
</style>
|