Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
f992e2ff
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f992e2ff
编写于
5月 25, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(h5): useMaxWidth
上级
2072af59
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
26 deletion
+38
-26
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+1
-1
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+14
-8
packages/uni-h5/src/framework/components/layout/index.tsx
packages/uni-h5/src/framework/components/layout/index.tsx
+11
-11
packages/uni-h5/src/service/api/ui/window.ts
packages/uni-h5/src/service/api/ui/window.ts
+12
-6
未找到文件。
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
f992e2ff
...
...
@@ -10569,7 +10569,7 @@ var LayoutComponent = /* @__PURE__ */ defineSystemComponent({
layoutState
,
windowState
}
=
__UNI_FEATURE_RESPONSIVE__
?
useState
()
:
{};
useMaxWidth
(
layoutState
,
rootRef
);
layoutState
&&
useMaxWidth
(
layoutState
,
rootRef
);
const
topWindow
=
__UNI_FEATURE_TOPWINDOW__
&&
useTopWindow
(
layoutState
);
const
leftWindow
=
__UNI_FEATURE_LEFTWINDOW__
&&
useLeftWindow
(
layoutState
);
const
rightWindow
=
__UNI_FEATURE_RIGHTWINDOW__
&&
useRightWindow
(
layoutState
);
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
f992e2ff
...
...
@@ -18042,7 +18042,7 @@ function createTabBarMidButtonTsx(color, iconPath, midButton, tabBar2, index2, o
}, null, 12, ["src"])], 4), createTabBarItemBdTsx(color, iconPath, midButton, tabBar2)], 12, ["onClick"]);
}
const DEFAULT_CSS_VAR_VALUE = "0px";
let globalLayoutState;
let globalLayoutState
= void 0
;
function getLayoutState() {
return globalLayoutState;
}
...
...
@@ -18058,7 +18058,7 @@ var LayoutComponent = /* @__PURE__ */ defineSystemComponent({
layoutState,
windowState
} = __UNI_FEATURE_RESPONSIVE__ ? useState() : {};
useMaxWidth(layoutState, rootRef);
layoutState &&
useMaxWidth(layoutState, rootRef);
const topWindow = __UNI_FEATURE_TOPWINDOW__ && useTopWindow(layoutState);
const leftWindow = __UNI_FEATURE_LEFTWINDOW__ && useLeftWindow(layoutState);
const rightWindow = __UNI_FEATURE_RIGHTWINDOW__ && useRightWindow(layoutState);
...
...
@@ -18442,27 +18442,33 @@ const hideRightWindow = /* @__PURE__ */ defineAsyncApi("hideRightWindow", (_, {r
});
const getTopWindowStyle = /* @__PURE__ */ defineSyncApi("getTopWindowStyle", () => {
const state2 = getLayoutState();
return Object.assign({}, state2.topWindowStyle);
return Object.assign({}, state2
&& state2
.topWindowStyle);
});
const setTopWindowStyle = /* @__PURE__ */ defineSyncApi("setTopWindowStyle", (style) => {
const state2 = getLayoutState();
state2.topWindowStyle = style;
if (state2) {
state2.topWindowStyle = style;
}
});
const getLeftWindowStyle = /* @__PURE__ */ defineSyncApi("getLeftWindowStyle", () => {
const state2 = getLayoutState();
return Object.assign({}, state2.leftWindowStyle);
return Object.assign({}, state2
&& state2
.leftWindowStyle);
});
const setLeftWindowStyle = /* @__PURE__ */ defineSyncApi("setLeftWindowStyle", (style) => {
const state2 = getLayoutState();
state2.leftWindowStyle = style;
if (state2) {
state2.leftWindowStyle = style;
}
});
const getRightWindowStyle = /* @__PURE__ */ defineSyncApi("getRightWindowStyle", () => {
const state2 = getLayoutState();
return Object.assign({}, state2.rightWindowStyle);
return Object.assign({}, state2
&& state2
.rightWindowStyle);
});
const setRightWindowStyle = /* @__PURE__ */ defineSyncApi("setRightWindowStyle", (style) => {
const state2 = getLayoutState();
state2.rightWindowStyle = style;
if (state2) {
state2.rightWindowStyle = style;
}
});
var api = /* @__PURE__ */ Object.freeze({
__proto__: null,
...
...
packages/uni-h5/src/framework/components/layout/index.tsx
浏览文件 @
f992e2ff
...
...
@@ -35,7 +35,7 @@ type KeepAliveRoute = ReturnType<typeof useKeepAliveRoute>
const
DEFAULT_CSS_VAR_VALUE
=
'
0px
'
let
globalLayoutState
:
LayoutState
let
globalLayoutState
:
LayoutState
|
undefined
=
undefined
export
function
getLayoutState
()
{
return
globalLayoutState
}
...
...
@@ -49,12 +49,12 @@ export default /*#__PURE__*/ defineSystemComponent({
useKeepAliveRoute
())
as
KeepAliveRoute
const
{
layoutState
,
windowState
}
=
__UNI_FEATURE_RESPONSIVE__
?
useState
()
:
({}
as
ReturnType
<
typeof
useState
>
)
useMaxWidth
(
layoutState
,
rootRef
)
const
topWindow
=
__UNI_FEATURE_TOPWINDOW__
&&
useTopWindow
(
layoutState
)
const
leftWindow
=
__UNI_FEATURE_LEFTWINDOW__
&&
useLeftWindow
(
layoutState
)
:
({}
as
{
layoutState
:
undefined
;
windowState
:
undefined
}
)
layoutState
&&
useMaxWidth
(
layoutState
,
rootRef
)
const
topWindow
=
__UNI_FEATURE_TOPWINDOW__
&&
useTopWindow
(
layoutState
!
)
const
leftWindow
=
__UNI_FEATURE_LEFTWINDOW__
&&
useLeftWindow
(
layoutState
!
)
const
rightWindow
=
__UNI_FEATURE_RIGHTWINDOW__
&&
useRightWindow
(
layoutState
)
__UNI_FEATURE_RIGHTWINDOW__
&&
useRightWindow
(
layoutState
!
)
const
showTabBar
=
(
__UNI_FEATURE_TABBAR__
&&
useShowTabBar
(
emit
))
as
ComputedRef
<
boolean
>
const
clazz
=
useAppClass
(
showTabBar
)
...
...
@@ -269,8 +269,8 @@ function useState() {
function
createLayoutTsx
(
keepAliveRoute
:
KeepAliveRoute
,
layoutState
:
LayoutState
,
windowState
:
WindowState
,
layoutState
?
:
LayoutState
,
windowState
?
:
WindowState
,
topWindow
?:
unknown
,
leftWindow
?:
unknown
,
rightWindow
?:
unknown
...
...
@@ -283,13 +283,13 @@ function createLayoutTsx(
return
routerVNode
}
const
topWindowTsx
=
__UNI_FEATURE_TOPWINDOW__
?
createTopWindowTsx
(
topWindow
,
layoutState
,
windowState
)
?
createTopWindowTsx
(
topWindow
,
layoutState
!
,
windowState
!
)
:
null
const
leftWindowTsx
=
__UNI_FEATURE_LEFTWINDOW__
?
createLeftWindowTsx
(
leftWindow
,
layoutState
,
windowState
)
?
createLeftWindowTsx
(
leftWindow
,
layoutState
!
,
windowState
!
)
:
null
const
rightWindowTsx
=
__UNI_FEATURE_RIGHTWINDOW__
?
createRightWindowTsx
(
rightWindow
,
layoutState
,
windowState
)
?
createRightWindowTsx
(
rightWindow
,
layoutState
!
,
windowState
!
)
:
null
return
(
<
uni
-
layout
>
...
...
packages/uni-h5/src/service/api/ui/window.ts
浏览文件 @
f992e2ff
...
...
@@ -137,41 +137,47 @@ export const hideRightWindow = <typeof uni.hideRightWindow>(
export
const
getTopWindowStyle
=
<
typeof
uni
.
getTopWindowStyle
>
(
defineSyncApi
(
'
getTopWindowStyle
'
,
()
=>
{
const
state
=
getLayoutState
()
return
Object
.
assign
({},
state
.
topWindowStyle
)
return
Object
.
assign
({},
state
&&
state
.
topWindowStyle
)
})
)
export
const
setTopWindowStyle
=
<
typeof
uni
.
setTopWindowStyle
>
(
defineSyncApi
(
'
setTopWindowStyle
'
,
(
style
)
=>
{
const
state
=
getLayoutState
()
state
.
topWindowStyle
=
style
if
(
state
)
{
state
.
topWindowStyle
=
style
}
})
)
export
const
getLeftWindowStyle
=
<
typeof
uni
.
getLeftWindowStyle
>
(
defineSyncApi
(
'
getLeftWindowStyle
'
,
()
=>
{
const
state
=
getLayoutState
()
return
Object
.
assign
({},
state
.
leftWindowStyle
)
return
Object
.
assign
({},
state
&&
state
.
leftWindowStyle
)
})
)
export
const
setLeftWindowStyle
=
<
typeof
uni
.
setLeftWindowStyle
>
(
defineSyncApi
(
'
setLeftWindowStyle
'
,
(
style
)
=>
{
const
state
=
getLayoutState
()
state
.
leftWindowStyle
=
style
if
(
state
)
{
state
.
leftWindowStyle
=
style
}
})
)
export
const
getRightWindowStyle
=
<
typeof
uni
.
getRightWindowStyle
>
(
defineSyncApi
(
'
getRightWindowStyle
'
,
()
=>
{
const
state
=
getLayoutState
()
return
Object
.
assign
({},
state
.
rightWindowStyle
)
return
Object
.
assign
({},
state
&&
state
.
rightWindowStyle
)
})
)
export
const
setRightWindowStyle
=
<
typeof
uni
.
setRightWindowStyle
>
(
defineSyncApi
(
'
setRightWindowStyle
'
,
(
style
)
=>
{
const
state
=
getLayoutState
()
state
.
rightWindowStyle
=
style
if
(
state
)
{
state
.
rightWindowStyle
=
style
}
})
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录