Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
6f2a1424
Commit
6f2a1424
authored
Sep 04, 2025
by
王炽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页图层效果处理
parent
43d6d708
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
15 deletions
+11
-15
xingmaLab.less
pages/xingmaLab/xingmaLab.less
+3
-2
xingmaLab.vue
pages/xingmaLab/xingmaLab.vue
+8
-13
No files found.
pages/xingmaLab/xingmaLab.less
View file @
6f2a1424
...
@@ -94,8 +94,9 @@
...
@@ -94,8 +94,9 @@
left: 50%;
left: 50%;
top: 15rpx;
top: 15rpx;
transform: translateX(-50%);
transform: translateX(-50%);
width: 96%;
width: 100%;
height: 86%;
height: 100%;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.2);
}
}
}
}
...
...
pages/xingmaLab/xingmaLab.vue
View file @
6f2a1424
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
<view
class=
"item_cangguan_img1"
<view
class=
"item_cangguan_img1"
:style=
"`background-image: url($
{item.imgUrl}); background-size: 707rpx auto; background-repeat: no-repeat;`"
:style=
"`background-image: url($
{item.imgUrl}); background-size: 707rpx auto; background-repeat: no-repeat;`"
mode="widthFix">
mode="widthFix">
<image
class=
"item_cangguan_img"
:src=
"`$
{item.imgUrl}`" mode="widthFix">
</image>
<image
class=
"item_cangguan_img"
:src=
"`$
{item.imgUrl}`" mode="widthFix"
@load="(e) => handleImageLoad(e, item, index)"
>
</image>
<
!--
<image
class=
"item_cangguan_img_up"
:src=
"`$
{item.imgUrl}`" mode="aspectFill">
</image>
--
>
<
image
class=
"item_cangguan_img_up"
:src=
"`$
{item.imgUrl}`" mode="aspectFill" :style="`width: ${item.targetWidth - 30}rpx; height: ${item.targetHeight - 126}rpx;`">
</image
>
</view>
</view>
<view
class=
"item_cangguan_bottom"
>
<view
class=
"item_cangguan_bottom"
>
...
@@ -302,21 +302,16 @@ const handleScrollToLower_shoucang = async () => {
...
@@ -302,21 +302,16 @@ const handleScrollToLower_shoucang = async () => {
const
handleImageLoad
=
(
e
,
item
,
index
)
=>
{
const
handleImageLoad
=
(
e
,
item
,
index
)
=>
{
// 获取图片的实际尺寸
// 获取图片的实际尺寸
const
{
width
,
height
}
=
e
.
detail
;
const
{
width
,
height
}
=
e
.
detail
;
console
.
log
(
'width='
,
width
);
console
.
log
(
'height='
,
height
);
// 计算图片在360rpx宽度下的实际高度
// 计算图片在360rpx宽度下的实际高度
// 360rpx 转换为 px (假设 1rpx = 0.5px,根据实际设备调整)
// 360rpx 转换为 px (假设 1rpx = 0.5px,根据实际设备调整)
const
rpxToPx
=
0.5
;
const
targetWidth
=
707
;
const
targetWidth
=
360
*
rpxToPx
;
const
rpxToPx
=
targetWidth
/
width
;
const
scale
=
targetWidth
/
width
;
const
targetHeight
=
height
*
rpxToPx
;
const
scaledHeight
=
height
*
scale
;
// 设置列表项的高度(图片高度 + 其他内容高度)
item
.
targetWidth
=
targetWidth
;
// 这里可以根据实际需要调整其他内容的高度
item
.
targetHeight
=
targetHeight
;
const
otherContentHeight
=
120
;
// 其他内容的预估高度
item
.
itemHeight
=
scaledHeight
+
otherContentHeight
;
console
.
log
(
`图片
${
index
}
加载完成,设置
高度为:
${
item
.
item
Height
}
px`
);
console
.
log
(
`图片
${
index
}
加载完成,设置
宽度为:
${
item
.
targetWidth
}
px, 设置高度为:
${
item
.
target
Height
}
px`
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment