Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
a4e99678
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
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看板
提交
a4e99678
编写于
9月 12, 2023
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新 示例项目 pull-zoom-image 向上滚动超过100px后固定头部
上级
f4250d6f
变更
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
浏览文件 @
a4e99678
<template>
<template>
<view @click="back" class="nav-back">
<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>
</view>
<scroll-view :scroll-y="true" style="flex:1;" :refresher-enabled="true"
<scroll-view :scroll-y="true" style="flex:1;" :refresher-enabled="true"
refresher-default-style="none" @refresherpulling="onRefresherpulling"
refresher-default-style="none" @refresherpulling="onRefresherpulling"
:refresher-threshold="300" :refresher-max-drag-distance="299">
:refresher-threshold="300" :refresher-max-drag-distance="299"
@scroll="onScroll" :rebound="false"
<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>
<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>
<view class="body">
<view class="user-info" ref="user-info">
<view class="user-info">
<image class="user-avatar" src="../../../static/test-image/logo.png" mode="widthFix"></image>
<image class="user-avatar" src="../../../static/test-image/logo.png" mode="widthFix"></image>
<view class="font-box">
<view class="font-box">
<text class="username">uni-app-x</text>
<text class="username">uni-app-x</text>
<text class="slogan">一次开发,多端覆盖</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>
</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 slot="refresher">
<view class="head-img-box">
<view class="head-img-box
-1
">
<image class="
head-img-1
" ref="head-img-1" src="../../../static/template/pull-zoom-image/head-img.jpg" mode="scaleToFill"></image>
<image class="
img
" ref="head-img-1" src="../../../static/template/pull-zoom-image/head-img.jpg" mode="scaleToFill"></image>
</view>
</view>
</view>
</view>
</scroll-view>
</scroll-view>
</template>
</template>
...
@@ -39,10 +39,24 @@
...
@@ -39,10 +39,24 @@
$INodeMap: new Map<string, INode>()
$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) {
onRefresherpulling(e : RefresherEvent) {
// console.log('onRefresherpulling',e.detail.dy)
// 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-1", 'transform', `scale(${pullingDistance / 200 + 1})`)
this.setINodeStyle("head-img-2", 'transform', `scale(${pullingDistance / 200 + 1})`)
this.setINodeStyle("head-img-2", 'transform', `scale(${pullingDistance / 200 + 1})`)
},
},
...
@@ -73,79 +87,80 @@
...
@@ -73,79 +87,80 @@
</script>
</script>
<style>
<style>
.head-img-box {
.head-img-box-1,
.head-img-box-2
{
position: relative;
position: relative;
height: 300px;
height: 300px;
}
}
.head-img-1,.head-img-2{
.head-img-box-1 .img,
.head-img-box-2 .img
{
position: absolute;
position: absolute;
left: -125rpx;
left: -125rpx;
width: 1000rpx;
width: 1000rpx;
height: 600px;
height: 600px;
}
}
.head-img-1 {
.head-img-box-1 .img {
top: 0;
top: 0;
}
}
.head-img-2 {
bottom: 0;
.head-img-box-2 .img {
bottom: -100;
}
.head-img-box-2 {
z-index: 9;
height: 200px;
}
}
.
body
{
.
user-info
{
margin-top: -
20
0px;
margin-top: -
11
0px;
width: 750rpx;
width: 750rpx;
}
.user-info {
padding: 15px;
padding: 15px;
flex-direction: row;
flex-direction: row;
z-index: 10;
}
}
.user-avatar {
.user-
info .user-
avatar {
width: 150rpx;
width: 150rpx;
height: 150rpx;
height: 150rpx;
border-radius: 100px;
border-radius: 100px;
border: 3px solid #FFF;
border: 3px solid #FFF;
}
}
.font-box {
.
user-info .
font-box {
flex-direction: column;
flex-direction: column;
justify-content: space-around;
justify-content: space-around;
padding: 10px;
padding: 10px;
}
}
.username {
.user
-info .user
name {
font-size: 26px;
font-size: 26px;
color: #FFF;
color: #FFF;
}
}
.slogan {
.
user-info .
slogan {
font-size: 16px;
font-size: 16px;
color: #FFF;
color: #FFF;
}
}
.content {
background-color: #FFF;
.list-box {
border-radius: 10px;
background-color: #FFF;
padding: 15px;
z-index: 1;
}
.list-item {
background-color: #FFF;
padding-top: 15px;
}
}
.last-list-item{
padding-bottom: 15px;
}
.item-content {
.list-box .item {
background-color: #fff;
margin: 0 5px;
padding: 10px;
padding: 10px;
margin: 5px;
border-radius: 5px;
border-radius: 5px;
border: 1px solid rgba(220, 220, 220, 0.3);
border: 1px solid rgba(220, 220, 220, 0.3);
}
}
.
item-content-
text {
.
list-box .
text {
font-size: 14px;
font-size: 14px;
color: #666;
color: #666;
line-height: 20px;
line-height: 20px;
...
@@ -155,7 +170,6 @@
...
@@ -155,7 +170,6 @@
position: absolute;
position: absolute;
top: 30px;
top: 30px;
left: 10px;
left: 10px;
background-color: rgba(220, 220, 220, 0.3);
border-radius: 100px;
border-radius: 100px;
width: 28px;
width: 28px;
height: 28px;
height: 28px;
...
...
static/template/pull-zoom-image/back.png
0 → 100644
浏览文件 @
a4e99678
8.1 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录