Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
78c9d2af
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6006
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
78c9d2af
编写于
9月 12, 2023
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新 示例项目 pull-zoom-image 向上滚动超过100px后固定头部
上级
592ce0dd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
56 deletion
+70
-56
pages/template/pull-zoom-image/pull-zoom-image.uvue
pages/template/pull-zoom-image/pull-zoom-image.uvue
+70
-56
static/template/pull-zoom-image/back.png
static/template/pull-zoom-image/back.png
+0
-0
未找到文件。
pages/template/pull-zoom-image/pull-zoom-image.uvue
浏览文件 @
78c9d2af
<template>
<view @click="back" class="nav-back">
<image class="back-img" src="/static/template/
scroll-fold-nav
/back.png" mode="widthFix"></image>
<image class="back-img" src="/static/template/
pull-zoom-image
/back.png" mode="widthFix"></image>
</view>
<scroll-view :scroll-y="true" style="flex:1;" :refresher-enabled="true"
refresher-default-style="none" @refresherpulling="onRefresherpulling"
:refresher-threshold="300" :refresher-max-drag-distance="299">
<view class="head-img-box">
<image class="head-img-2" ref="head-img-2" src="../../../static/template/pull-zoom-image/head-img.jpg" mode="scaleToFill"></image>
refresher-default-style="none" @refresherpulling="onRefresherpulling"
:refresher-threshold="300" :refresher-max-drag-distance="299"
@scroll="onScroll" :rebound="false"
>
<view class="head-img-box-2" ref="head-img-box-2">
<image class="img" ref="head-img-2" src="../../../static/template/pull-zoom-image/head-img.jpg" mode="scaleToFill"></image>
</view>
<view class="body">
<view class="user-info">
<image class="user-avatar" src="../../../static/test-image/logo.png" mode="widthFix"></image>
<view class="font-box">
<text class="username">uni-app-x</text>
<text class="slogan">一次开发,多端覆盖</text>
</view>
</view>
<view class="list-item" v-for="(item,index) in 30" :key="index" :class="{'last-list-item':index == 29}">
<view class="item-content">
<text class="item-content-text" style="padding-left: 4px;">{{item}}. 占位</text>
</view>
<view class="user-info" ref="user-info">
<image class="user-avatar" src="../../../static/test-image/logo.png" mode="widthFix"></image>
<view class="font-box">
<text class="username">uni-app-x</text>
<text class="slogan">一次开发,多端覆盖</text>
</view>
</view>
</view>
<view class="list-box">
<view class="item" v-for="(item,index) in 30" :key="index">
<text class="text">{{item}}. 占位</text>
</view>
</view>
<view slot="refresher">
<view class="head-img-box">
<image class="
head-img-1
" ref="head-img-1" src="../../../static/template/pull-zoom-image/head-img.jpg" mode="scaleToFill"></image>
<view class="head-img-box
-1
">
<image class="
img
" ref="head-img-1" src="../../../static/template/pull-zoom-image/head-img.jpg" mode="scaleToFill"></image>
</view>
</view>
</view>
</scroll-view>
</template>
...
...
@@ -39,10 +39,24 @@
$INodeMap: new Map<string, INode>()
}
},
methods: {
methods: {
onScroll(e : ScrollEvent) {
const {scrollTop} = e.detail
let y : number = scrollTop - 110
let s : number = (100 - scrollTop/3)/100
if(y < 0){
y = 0
}
if(s < 0.7){
s = 0.7
}
let x : number = (1 - s) * -100
this.setINodeStyle("user-info", "transform", `translate(${x},${y + (s-1)* -50}px) scale(${s})`)
this.setINodeStyle("head-img-box-2", "transform", `translateY(${y}px)`)
},
onRefresherpulling(e : RefresherEvent) {
// console.log('onRefresherpulling',e.detail.dy)
let pullingDistance
:
number = e.detail.dy
let pullingDistance
:
number = e.detail.dy
this.setINodeStyle("head-img-1", 'transform', `scale(${pullingDistance / 200 + 1})`)
this.setINodeStyle("head-img-2", 'transform', `scale(${pullingDistance / 200 + 1})`)
},
...
...
@@ -73,79 +87,80 @@
</script>
<style>
.head-img-box {
.head-img-box-1,
.head-img-box-2
{
position: relative;
height: 300px;
}
.head-img-1,.head-img-2{
.head-img-box-1 .img,
.head-img-box-2 .img
{
position: absolute;
left: -125rpx;
width: 1000rpx;
height: 600px;
}
.head-img-1 {
.head-img-box-1 .img {
top: 0;
}
.head-img-2 {
bottom: 0;
.head-img-box-2 .img {
bottom: -100;
}
.head-img-box-2 {
z-index: 9;
height: 200px;
}
.
body
{
margin-top: -
20
0px;
.
user-info
{
margin-top: -
11
0px;
width: 750rpx;
}
.user-info {
padding: 15px;
flex-direction: row;
flex-direction: row;
z-index: 10;
}
.user-avatar {
.user-
info .user-
avatar {
width: 150rpx;
height: 150rpx;
border-radius: 100px;
border: 3px solid #FFF;
}
.font-box {
.
user-info .
font-box {
flex-direction: column;
justify-content: space-around;
padding: 10px;
}
.username {
.user
-info .user
name {
font-size: 26px;
color: #FFF;
}
.slogan {
.
user-info .
slogan {
font-size: 16px;
color: #FFF;
}
.content {
background-color: #FFF;
border-radius: 10px;
padding: 15px;
}
.list-item {
background-color: #FFF;
padding-top: 15px;
.list-box {
background-color: #FFF;
z-index: 1;
}
.last-list-item{
padding-bottom: 15px;
}
.item-content {
background-color: #fff;
margin: 0 5px;
.list-box .item {
padding: 10px;
margin: 5px;
border-radius: 5px;
border: 1px solid rgba(220, 220, 220, 0.3);
}
.
item-content-
text {
.
list-box .
text {
font-size: 14px;
color: #666;
line-height: 20px;
...
...
@@ -155,7 +170,6 @@
position: absolute;
top: 30px;
left: 10px;
background-color: rgba(220, 220, 220, 0.3);
border-radius: 100px;
width: 28px;
height: 28px;
...
...
static/template/pull-zoom-image/back.png
0 → 100644
浏览文件 @
78c9d2af
8.1 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录