Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzj-java
uni-app
提交
5ba56f14
U
uni-app
项目概览
wzj-java
/
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,发现更多精彩内容 >>
提交
5ba56f14
编写于
3月 26, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: tsx
上级
ad78aea8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
125 addition
and
81 deletion
+125
-81
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+32
-36
packages/uni-h5/src/framework/components/app/layout/index.tsx
...ages/uni-h5/src/framework/components/app/layout/index.tsx
+11
-8
packages/uni-h5/src/framework/components/app/test.vue
packages/uni-h5/src/framework/components/app/test.vue
+5
-10
packages/uni-h5/src/framework/components/page/index.tsx
packages/uni-h5/src/framework/components/page/index.tsx
+4
-10
packages/uni-h5/src/framework/components/page/pageBody.tsx
packages/uni-h5/src/framework/components/page/pageBody.tsx
+53
-0
packages/uni-h5/src/framework/components/page/pageHead.tsx
packages/uni-h5/src/framework/components/page/pageHead.tsx
+18
-16
packages/uni-h5/src/framework/plugin/components.ts
packages/uni-h5/src/framework/plugin/components.ts
+2
-1
未找到文件。
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
5ba56f14
...
...
@@ -884,7 +884,10 @@ var Layout = defineComponent({
return
()
=>
{
const
layoutTsx
=
createLayoutTsx
(
keepAliveRoute
);
const
tabBarTsx
=
__UNI_FEATURE_TABBAR__
&&
createTabBarTsx
(
route
);
return
[
layoutTsx
,
tabBarTsx
].
filter
(
Boolean
);
if
(
!
tabBarTsx
)
{
return
layoutTsx
;
}
return
[
layoutTsx
,
tabBarTsx
];
};
}
});
...
...
@@ -8041,16 +8044,18 @@ var PageHead = defineComponent({
clazz
,
style
}
=
usePageHead
(
navigationBar
);
const
backButtonJsx
=
__UNI_FEATURE_PAGES__
?
createBackButtonJsx
(
navigationBar
)
:
null
;
const
leftButtonsJsx
=
__UNI_FEATURE_NAVIGATIONBAR_BUTTONS__
?
createButtonsJsx
(
"
left
"
,
navigationBar
)
:
[];
return
()
=>
createVNode
(
"
uni-page-head
"
,
{
"
uni-page-head-type
"
:
navigationBar
.
type
},
[
createVNode
(
"
div
"
,
{
class
:
clazz
.
value
,
style
:
style
.
value
},
[
createVNode
(
"
div
"
,
{
class
:
"
uni-page-head-hd
"
},
[
backButtonJsx
,
...
leftButtonsJsx
])],
6
)],
8
,
[
"
uni-page-head-type
"
]);
return
()
=>
{
const
backButtonJsx
=
__UNI_FEATURE_PAGES__
?
createBackButtonJsx
(
navigationBar
)
:
null
;
const
leftButtonsJsx
=
__UNI_FEATURE_NAVIGATIONBAR_BUTTONS__
?
createButtonsJsx
(
"
left
"
,
navigationBar
)
:
[];
return
createVNode
(
"
uni-page-head
"
,
{
"
uni-page-head-type
"
:
navigationBar
.
type
},
[
createVNode
(
"
div
"
,
{
class
:
clazz
.
value
,
style
:
style
.
value
},
[
createVNode
(
"
div
"
,
{
class
:
"
uni-page-head-hd
"
},
[
backButtonJsx
,
...
leftButtonsJsx
])],
6
)],
8
,
[
"
uni-page-head-type
"
]);
};
}
});
function
createBackButtonJsx
(
navigationBar
)
{
...
...
@@ -8361,43 +8366,34 @@ function usePageRefresh(refreshRef) {
var
PageBody
=
defineComponent
({
name
:
"
PageBody
"
,
setup
(
props
,
ctx
)
{
const
pageMeta
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
?
usePageMeta
()
:
void
0
;
const
refreshRef
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
?
ref
(
null
)
:
void
0
;
const
pageMeta
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
&&
usePageMeta
()
;
const
refreshRef
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
&&
ref
(
null
)
;
const
pageRefresh
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
&&
pageMeta
.
enablePullDownRefresh
?
usePageRefresh
(
refreshRef
)
:
null
;
return
()
=>
(
openBlock
(),
createBlock
(
Fragment
,
null
,
[
createPageRefreshVNode
(
refreshRef
,
pageMeta
),
createVNode
(
"
uni-page-wrapper
"
,
pageRefresh
,
[
createVNode
(
"
uni-page-body
"
,
null
,
[
renderSlot
(
ctx
.
slots
,
"
default
"
)
])
])
]));
return
()
=>
{
const
pageRefreshTsx
=
createPageRefreshTsx
(
refreshRef
,
pageMeta
);
return
createVNode
(
Fragment
,
null
,
[
pageRefreshTsx
,
createVNode
(
"
uni-page-wrapper
"
,
pageRefresh
,
[
createVNode
(
"
uni-page-body
"
,
null
,
[
renderSlot
(
ctx
.
slots
,
"
default
"
)])],
16
)]);
};
}
});
function
createPageRefreshVNode
(
refreshRef
,
pageMeta
)
{
if
(
!
__UNI_FEATURE_PULL_DOWN_REFRESH__
)
{
return
createCommentVNode
(
""
,
true
);
}
if
(
!
pageMeta
.
enablePullDownRefresh
)
{
return
createCommentVNode
(
""
,
true
);
function
createPageRefreshTsx
(
refreshRef
,
pageMeta
)
{
if
(
!
__UNI_FEATURE_PULL_DOWN_REFRESH__
||
!
pageMeta
.
enablePullDownRefresh
)
{
return
null
;
}
return
createVNode
(
_sfc_main$2
,
{
ref
:
refreshRef
},
null
,
512
);
return
createVNode
(
_sfc_main$2
,
{
ref
:
refreshRef
},
null
,
512
);
}
var
index
=
defineComponent
({
name
:
"
Page
"
,
setup
(
props
,
ctx
)
{
providePageMeta
();
return
()
=>
(
openBlock
(),
createBlock
(
"
uni-page
"
,
null
,
[
createPageHeadVNode
(),
createPageBodyVNode
(
ctx
)
]));
return
()
=>
createVNode
(
"
uni-page
"
,
null
,
[
createVNode
(
PageHead
,
null
,
null
),
createPageBodyVNode
(
ctx
)]);
}
});
function
createPageHeadVNode
()
{
return
createVNode
(
PageHead
);
}
function
createPageBodyVNode
(
ctx
)
{
return
openBlock
(),
createBlock
(
PageBody
,
{
key
:
0
},
{
return
openBlock
(),
createBlock
(
PageBody
,
{
key
:
0
},
{
default
:
withCtx
(()
=>
[
renderSlot
(
ctx
.
slots
,
"
page
"
)]),
_
:
3
});
...
...
packages/uni-h5/src/framework/components/app/layout/index.tsx
浏览文件 @
5ba56f14
...
...
@@ -25,8 +25,10 @@ export default defineComponent({
},
emits
:
[
'
change
'
],
setup
()
{
const
route
=
__UNI_FEATURE_TABBAR__
&&
useRoute
()
const
keepAliveRoute
=
__UNI_FEATURE_PAGES__
&&
useKeepAliveRoute
()
const
route
=
(
__UNI_FEATURE_TABBAR__
&&
useRoute
())
as
RouteLocationNormalizedLoaded
const
keepAliveRoute
=
(
__UNI_FEATURE_PAGES__
&&
useKeepAliveRoute
())
as
KeepAliveRoute
const
topWindow
=
__UNI_FEATURE_TOPWINDOW__
&&
useTopWindow
()
const
leftWindow
=
__UNI_FEATURE_LEFTWINDOW__
&&
useLeftWindow
()
const
rightWindow
=
__UNI_FEATURE_RIGHTWINDOW__
&&
useRightWindow
()
...
...
@@ -37,22 +39,23 @@ export default defineComponent({
leftWindow
,
rightWindow
)
const
tabBarTsx
=
__UNI_FEATURE_TABBAR__
&&
createTabBarTsx
(
route
as
RouteLocationNormalizedLoaded
)
return
[
layoutTsx
,
tabBarTsx
].
filter
(
Boolean
)
const
tabBarTsx
=
__UNI_FEATURE_TABBAR__
&&
createTabBarTsx
(
route
)
if
(
!
tabBarTsx
)
{
return
layoutTsx
}
return
[
layoutTsx
,
tabBarTsx
]
}
},
})
function
createLayoutTsx
(
keepAliveRoute
:
KeepAliveRoute
|
false
,
keepAliveRoute
:
KeepAliveRoute
,
topWindow
?:
unknown
,
leftWindow
?:
unknown
,
rightWindow
?:
unknown
)
{
const
routerVNode
=
__UNI_FEATURE_PAGES__
?
createRouterViewVNode
(
keepAliveRoute
as
KeepAliveRoute
)
?
createRouterViewVNode
(
keepAliveRoute
)
:
createPageVNode
()
// 非响应式
if
(
!
__UNI_FEATURE_RESPONSIVE__
)
{
...
...
packages/uni-h5/src/framework/components/app/test.vue
浏览文件 @
5ba56f14
<
template
>
<uni-layout>
<uni-top-window>
</uni-top-window>
<uni-content>
<uni-main>
<keep-alive>
<router-view
/>
</keep-alive>
</uni-main>
</uni-content>
</uni-layout>
<uni-page-wrapper>
<uni-page-body>
<slot
/>
</uni-page-body>
</uni-page-wrapper>
</
template
>
packages/uni-h5/src/framework/components/page/index.ts
→
packages/uni-h5/src/framework/components/page/index.ts
x
浏览文件 @
5ba56f14
...
...
@@ -3,7 +3,6 @@ import {
openBlock
,
renderSlot
,
createBlock
,
createVNode
,
SetupContext
,
defineComponent
,
}
from
'
vue
'
...
...
@@ -17,19 +16,14 @@ export default defineComponent({
setup
(
props
,
ctx
)
{
providePageMeta
()
return
()
=>
(
openBlock
(),
createBlock
(
'
uni-page
'
,
null
,
[
createPageHeadVNode
(),
createPageBodyVNode
(
ctx
),
])
<
uni
-
page
>
<
PageHead
/>
{
createPageBodyVNode
(
ctx
)
}
</
uni
-
page
>
)
},
})
function
createPageHeadVNode
()
{
return
createVNode
(
PageHead
)
}
function
createPageBodyVNode
(
ctx
:
SetupContext
)
{
return
(
openBlock
(),
...
...
packages/uni-h5/src/framework/components/page/pageBody.ts
→
packages/uni-h5/src/framework/components/page/pageBody.ts
x
浏览文件 @
5ba56f14
...
...
@@ -8,6 +8,7 @@ import {
defineComponent
,
createCommentVNode
,
Ref
,
VNodeProps
,
}
from
'
vue
'
import
{
usePageMeta
}
from
'
../../plugin/provide
'
...
...
@@ -19,44 +20,34 @@ import { usePageRefresh } from './page-refresh'
export
default
defineComponent
({
name
:
'
PageBody
'
,
setup
(
props
,
ctx
)
{
const
pageMeta
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
?
usePageMeta
()
:
undefined
const
pageMeta
=
(
__UNI_FEATURE_PULL_DOWN_REFRESH__
&&
usePageMeta
())
as
UniApp
.
PageRouteMeta
const
refreshRef
=
(
__UNI_FEATURE_PULL_DOWN_REFRESH__
&&
ref
(
null
))
as
Ref
<
null
>
const
refreshRef
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
?
ref
(
null
)
:
undefined
const
pageRefresh
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
&&
pageMeta
!
.
enablePullDownRefresh
?
usePageRefresh
(
refreshRef
!
)
__UNI_FEATURE_PULL_DOWN_REFRESH__
&&
pageMeta
.
enablePullDownRefresh
?
usePageRefresh
(
refreshRef
)
:
null
return
()
=>
(
openBlock
(),
createBlock
(
Fragment
,
null
,
[
createPageRefreshVNode
(
refreshRef
!
,
pageMeta
!
),
createVNode
(
'
uni-page-wrapper
'
,
pageRefresh
,
[
createVNode
(
'
uni-page-body
'
,
null
,
[
renderSlot
(
ctx
.
slots
,
'
default
'
),
]),
]),
]
)
)
return
()
=>
{
const
pageRefreshTsx
=
createPageRefreshTsx
(
refreshRef
,
pageMeta
)
return
(
<>
{
pageRefreshTsx
}
<
uni
-
page
-
wrapper
{
...
pageRefresh
}
>
<
uni
-
page
-
body
>
{
renderSlot
(
ctx
.
slots
,
'
default
'
)
}
</
uni
-
page
-
body
>
</
uni
-
page
-
wrapper
>
</>
)
}
},
})
function
createPageRefreshVNode
(
refreshRef
:
Ref
,
pageMeta
:
UniApp
.
PageRouteMeta
)
{
if
(
!
__UNI_FEATURE_PULL_DOWN_REFRESH__
)
{
return
createCommentVNode
(
''
,
true
)
}
if
(
!
pageMeta
.
enablePullDownRefresh
)
{
return
createCommentVNode
(
''
,
true
)
function
createPageRefreshTsx
(
refreshRef
:
Ref
,
pageMeta
:
UniApp
.
PageRouteMeta
)
{
if
(
!
__UNI_FEATURE_PULL_DOWN_REFRESH__
||
!
pageMeta
.
enablePullDownRefresh
)
{
return
null
}
return
createVNode
(
PageRefresh
,
{
ref
:
refreshRef
},
null
,
512
/* NEED_PATCH */
)
return
<
PageRefresh
ref
=
{
refreshRef
}
/>
}
packages/uni-h5/src/framework/components/page/pageHead.tsx
浏览文件 @
5ba56f14
...
...
@@ -9,23 +9,25 @@ export default defineComponent({
const
navigationBar
=
pageMeta
.
navigationBar
UniServiceJSBridge
.
emit
(
'
onNavigationBarChange
'
,
navigationBar
.
titleText
)
const
{
clazz
,
style
}
=
usePageHead
(
navigationBar
)
// 单页面无需back按钮
const
backButtonJsx
=
__UNI_FEATURE_PAGES__
?
createBackButtonJsx
(
navigationBar
)
:
null
const
leftButtonsJsx
=
__UNI_FEATURE_NAVIGATIONBAR_BUTTONS__
?
createButtonsJsx
(
'
left
'
,
navigationBar
)
:
[]
return
()
=>
(
<
uni
-
page
-
head
uni
-
page
-
head
-
type
=
{
navigationBar
.
type
}
>
<
div
class
=
{
clazz
.
value
}
style
=
{
style
.
value
}
>
<
div
class
=
"uni-page-head-hd"
>
{
backButtonJsx
}
{
...
leftButtonsJsx
}
return
()
=>
{
// 单页面无需back按钮
const
backButtonJsx
=
__UNI_FEATURE_PAGES__
?
createBackButtonJsx
(
navigationBar
)
:
null
const
leftButtonsJsx
=
__UNI_FEATURE_NAVIGATIONBAR_BUTTONS__
?
createButtonsJsx
(
'
left
'
,
navigationBar
)
:
[]
return
(
<
uni
-
page
-
head
uni
-
page
-
head
-
type
=
{
navigationBar
.
type
}
>
<
div
class
=
{
clazz
.
value
}
style
=
{
style
.
value
}
>
<
div
class
=
"uni-page-head-hd"
>
{
backButtonJsx
}
{
...
leftButtonsJsx
}
</
div
>
</
div
>
</
div
>
</
uni
-
page
-
head
>
)
</
uni
-
page
-
head
>
)
}
},
})
...
...
packages/uni-h5/src/framework/plugin/components.ts
浏览文件 @
5ba56f14
...
...
@@ -3,9 +3,10 @@ import { App } from 'vue'
import
{
COMPONENT_NAME_PREFIX
}
from
'
@dcloudio/uni-shared
'
import
AppComponent
from
'
../components/app/index
'
// import TestComponent from '../components/app/test.vue'
export
function
initSystemComponents
(
app
:
App
)
{
// @ts-ignore
AppComponent
.
name
=
COMPONENT_NAME_PREFIX
+
AppComponent
.
name
app
.
component
(
AppComponent
.
name
,
AppComponent
)
// app.component(TestComponent.name, TestComponent)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录