<script setup lang="ts">
const { safeAreaInsets } = uni.getSystemInfoSync();
const pages = getCurrentPages();
type PageInstance = Page.PageInstance &
WechatMiniprogram.Page.InstanceMethods<any>;
const pageInstance = pages.at(-1) as PageInstance;
onReady(() => {
pageInstance.animate(
'.navbar',
[{ backgroundColor: 'red' }, { backgroundColor: '#f8f8f8' }],
1000,
{
scrollSource: '#scroller',
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 50,
},
);
pageInstance.animate(
'.navbar .title',
[{ color: 'transparent' }, { color: '#000' }],
1000,
{
scrollSource: '#scroller',
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 50,
},
);
});
</script>
<template>
<view class="box">
<view class="navbar" :style="{ paddingTop: `${safeAreaInsets?.top}px` }">
<view class="wrap">
<view class="title">qianba钱包</view>
</view>
</view>
<scroll-view id="scroller" enable-back-to-top scroll-y class="viewport">
<template>
<view v-for="item in 100" :key="item">{{ item }}</view>
</template>
</scroll-view>
</view>
</template>
<style lang="scss">
.box {
display: flex;
flex-direction: column;
height: 100%;
}
#scroller {
overflow: scroll;
height: 80vh;
}
.title {
text-align: center;
}
</style>