Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
菜鸟程序猿_c
uni-app
提交
1f094875
U
uni-app
项目概览
菜鸟程序猿_c
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1f094875
编写于
6月 29, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复 image 组件使用 transform 样式后,大小计算错误的问题
上级
9ee8be71
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
25 addition
and
37 deletion
+25
-37
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+6
-10
packages/uni-components/src/components/image/index.tsx
packages/uni-components/src/components/image/index.tsx
+4
-4
packages/uni-components/src/components/resize-sensor/index.tsx
...ges/uni-components/src/components/resize-sensor/index.tsx
+3
-3
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+6
-10
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+6
-10
未找到文件。
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
1f094875
...
...
@@ -6152,12 +6152,9 @@
});
watch
(()
=>
extend
({},
size2
),
(
value
)
=>
emit2
(
"
resize
"
,
value
));
return
()
=>
{
const
{
width
,
height
}
=
rootRef
.
value
.
getBoundingClientRect
();
size2
.
width
=
width
;
size2
.
height
=
height
;
const
rootEl
=
rootRef
.
value
;
size2
.
width
=
rootEl
.
offsetWidth
;
size2
.
height
=
rootEl
.
offsetHeight
;
reset2
();
};
}
...
...
@@ -6278,8 +6275,8 @@
}
};
const
FIX_MODES
=
{
widthFix
:
[
"
w
idth
"
,
"
height
"
],
heightFix
:
[
"
h
eight
"
,
"
width
"
]
widthFix
:
[
"
offsetW
idth
"
,
"
height
"
],
heightFix
:
[
"
offsetH
eight
"
,
"
width
"
]
};
const
IMAGE_MODES
=
{
aspectFit
:
[
"
center center
"
,
"
contain
"
],
...
...
@@ -6449,8 +6446,7 @@
return
;
}
const
rootEl
=
rootRef
.
value
;
const
rect
=
rootEl
.
getBoundingClientRect
();
const
value
=
rect
[
names
[
0
]];
const
value
=
rootEl
[
names
[
0
]];
if
(
value
)
{
rootEl
.
style
[
names
[
1
]]
=
fixNumber
(
value
/
ratio
)
+
"
px
"
;
}
...
...
packages/uni-components/src/components/image/index.tsx
浏览文件 @
1f094875
...
...
@@ -37,8 +37,8 @@ type ImageState = ReturnType<typeof useImageState>
type
FixSize
=
ReturnType
<
typeof
useImageSize
>
[
'
fixSize
'
]
const
FIX_MODES
=
{
widthFix
:
[
'
w
idth
'
,
'
height
'
],
heightFix
:
[
'
h
eight
'
,
'
width
'
],
widthFix
:
[
'
offsetW
idth
'
,
'
height
'
],
heightFix
:
[
'
offsetH
eight
'
,
'
width
'
],
}
const
IMAGE_MODES
=
{
aspectFit
:
[
'
center center
'
,
'
contain
'
],
...
...
@@ -76,6 +76,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
<
div
style
=
{
modeStyle
}
/>
{
imgSrc
?
<
img
src
=
{
imgSrc
}
draggable
=
{
props
.
draggable
}
/>
:
<
img
/>
}
{
FIX_MODES
[
mode
as
keyof
typeof
FIX_MODES
]
?
(
// @ts-ignore
<
ResizeSensor
onResize
=
{
fixSize
}
/>
)
:
(
<
span
></
span
>
...
...
@@ -209,8 +210,7 @@ function useImageSize(
return
}
const
rootEl
=
rootRef
.
value
!
const
rect
=
rootEl
.
getBoundingClientRect
()
const
value
=
rect
[
names
[
0
]
as
keyof
DOMRect
]
as
number
const
value
=
rootEl
[
names
[
0
]
as
'
offsetWidth
'
|
'
offsetHeight
'
]
if
(
value
)
{
rootEl
.
style
[
names
[
1
]
as
'
height
'
|
'
width
'
]
=
fixNumber
(
value
/
ratio
)
+
'
px
'
...
...
packages/uni-components/src/components/resize-sensor/index.tsx
浏览文件 @
1f094875
...
...
@@ -49,9 +49,9 @@ function useResizeSensorUpdate(
(
value
:
typeof
size
)
=>
emit
(
'
resize
'
,
value
)
)
return
()
=>
{
const
{
width
,
height
}
=
rootRef
.
value
!
.
getBoundingClientRect
()
size
.
width
=
w
idth
size
.
height
=
h
eight
const
rootEl
=
rootRef
.
value
!
size
.
width
=
rootEl
.
offsetW
idth
size
.
height
=
rootEl
.
offsetH
eight
reset
()
}
}
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
1f094875
...
...
@@ -1573,12 +1573,9 @@ function useResizeSensorUpdate(rootRef, emit2, reset) {
});
vue
.
watch
(()
=>
shared
.
extend
({},
size
),
(
value
)
=>
emit2
(
"
resize
"
,
value
));
return
()
=>
{
const
{
width
,
height
}
=
rootRef
.
value
.
getBoundingClientRect
();
size
.
width
=
width
;
size
.
height
=
height
;
const
rootEl
=
rootRef
.
value
;
size
.
width
=
rootEl
.
offsetWidth
;
size
.
height
=
rootEl
.
offsetHeight
;
reset
();
};
}
...
...
@@ -2605,8 +2602,8 @@ const props$p = {
}
};
const
FIX_MODES
=
{
widthFix
:
[
"
w
idth
"
,
"
height
"
],
heightFix
:
[
"
h
eight
"
,
"
width
"
]
widthFix
:
[
"
offsetW
idth
"
,
"
height
"
],
heightFix
:
[
"
offsetH
eight
"
,
"
width
"
]
};
const
IMAGE_MODES
=
{
aspectFit
:
[
"
center center
"
,
"
contain
"
],
...
...
@@ -2764,8 +2761,7 @@ function useImageSize(rootRef, props2, state) {
return
;
}
const
rootEl
=
rootRef
.
value
;
const
rect
=
rootEl
.
getBoundingClientRect
();
const
value
=
rect
[
names
[
0
]];
const
value
=
rootEl
[
names
[
0
]];
if
(
value
)
{
rootEl
.
style
[
names
[
1
]]
=
fixNumber
(
value
/
ratio
)
+
"
px
"
;
}
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
1f094875
...
...
@@ -5780,12 +5780,9 @@ function useResizeSensorUpdate(rootRef, emit2, reset) {
});
watch(() => extend({}, size), (value) => emit2("resize", value));
return () => {
const {
width,
height
} = rootRef.value.getBoundingClientRect();
size.width = width;
size.height = height;
const rootEl = rootRef.value;
size.width = rootEl.offsetWidth;
size.height = rootEl.offsetHeight;
reset();
};
}
...
...
@@ -7539,8 +7536,8 @@ const props$w = {
}
};
const FIX_MODES = {
widthFix: ["
w
idth", "height"],
heightFix: ["
h
eight", "width"]
widthFix: ["
offsetW
idth", "height"],
heightFix: ["
offsetH
eight", "width"]
};
const IMAGE_MODES = {
aspectFit: ["center center", "contain"],
...
...
@@ -7710,8 +7707,7 @@ function useImageSize(rootRef, props2, state2) {
return;
}
const rootEl = rootRef.value;
const rect = rootEl.getBoundingClientRect();
const value = rect[names[0]];
const value = rootEl[names[0]];
if (value) {
rootEl.style[names[1]] = fixNumber(value / ratio) + "px";
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录