Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
76729422
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,发现更多精彩内容 >>
提交
76729422
编写于
3月 23, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(h5): PageComponent
上级
2f1cf321
变更
32
展开全部
隐藏空白更改
内联
并排
Showing
32 changed file
with
5762 addition
and
1438 deletion
+5762
-1438
packages/global.d.ts
packages/global.d.ts
+1
-0
packages/shims-uni-app.d.ts
packages/shims-uni-app.d.ts
+32
-0
packages/uni-core/src/helpers/util.ts
packages/uni-core/src/helpers/util.ts
+11
-0
packages/uni-h5/dist/assets/index-77a30187.css
packages/uni-h5/dist/assets/index-77a30187.css
+1064
-0
packages/uni-h5/dist/assets/index-81a48a08.css
packages/uni-h5/dist/assets/index-81a48a08.css
+1080
-0
packages/uni-h5/dist/assets/index-bd45f813.css
packages/uni-h5/dist/assets/index-bd45f813.css
+1363
-0
packages/uni-h5/dist/assets/index-e524b513.css
packages/uni-h5/dist/assets/index-e524b513.css
+1157
-0
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+445
-1228
packages/uni-h5/src/framework/components/page/index.ts
packages/uni-h5/src/framework/components/page/index.ts
+45
-0
packages/uni-h5/src/framework/components/page/index.vue
packages/uni-h5/src/framework/components/page/index.vue
+4
-4
packages/uni-h5/src/framework/components/page/pageBody.ts
packages/uni-h5/src/framework/components/page/pageBody.ts
+62
-0
packages/uni-h5/src/framework/components/page/pageBody.vue
packages/uni-h5/src/framework/components/page/pageBody.vue
+1
-0
packages/uni-h5/src/framework/components/page/pageHead.ts
packages/uni-h5/src/framework/components/page/pageHead.ts
+23
-0
packages/uni-h5/src/framework/components/page/pageRefresh.vue
...ages/uni-h5/src/framework/components/page/pageRefresh.vue
+0
-144
packages/uni-h5/src/framework/components/page/pageRefresh/index.ts
...uni-h5/src/framework/components/page/pageRefresh/index.ts
+267
-0
packages/uni-h5/src/framework/components/page/pageRefresh/index.vue
...ni-h5/src/framework/components/page/pageRefresh/index.vue
+50
-0
packages/uni-h5/src/framework/plugin/index.ts
packages/uni-h5/src/framework/plugin/index.ts
+4
-2
packages/uni-h5/src/framework/plugin/page.ts
packages/uni-h5/src/framework/plugin/page.ts
+1
-7
packages/uni-h5/src/framework/plugin/provide/index.ts
packages/uni-h5/src/framework/plugin/provide/index.ts
+2
-10
packages/uni-h5/src/framework/plugin/provide/layout.ts
packages/uni-h5/src/framework/plugin/provide/layout.ts
+13
-2
packages/uni-h5/src/framework/plugin/provide/page.ts
packages/uni-h5/src/framework/plugin/provide/page.ts
+79
-0
packages/uni-h5/src/framework/plugin/router.ts
packages/uni-h5/src/framework/plugin/router.ts
+1
-3
packages/uni-h5/src/index.ts
packages/uni-h5/src/index.ts
+1
-1
packages/uni-mp-vue/src/plugin.ts
packages/uni-mp-vue/src/plugin.ts
+1
-1
packages/uni-vue/src/apiLifecycle.ts
packages/uni-vue/src/apiLifecycle.ts
+1
-1
packages/uni-vue/src/appConfig.ts
packages/uni-vue/src/appConfig.ts
+1
-1
packages/uni-vue/src/componentInstance.ts
packages/uni-vue/src/componentInstance.ts
+1
-1
packages/uni-vue/src/componentOptions.ts
packages/uni-vue/src/componentOptions.ts
+1
-1
packages/uni-vue/src/index.ts
packages/uni-vue/src/index.ts
+1
-1
packages/vite-plugin-uni/package.json
packages/vite-plugin-uni/package.json
+1
-0
packages/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
...s/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
+48
-31
tsconfig.json
tsconfig.json
+1
-0
未找到文件。
packages/global.d.ts
浏览文件 @
76729422
...
@@ -32,6 +32,7 @@ declare var __UNI_FEATURE_TOPWINDOW__: boolean
...
@@ -32,6 +32,7 @@ declare var __UNI_FEATURE_TOPWINDOW__: boolean
declare
var
__UNI_FEATURE_LEFTWINDOW__
:
boolean
declare
var
__UNI_FEATURE_LEFTWINDOW__
:
boolean
declare
var
__UNI_FEATURE_RIGHTWINDOW__
:
boolean
declare
var
__UNI_FEATURE_RIGHTWINDOW__
:
boolean
declare
var
__UNI_FEATURE_RESPONSIVE__
:
boolean
declare
var
__UNI_FEATURE_RESPONSIVE__
:
boolean
declare
var
__UNI_FEATURE_PULL_DOWN_REFRESH__
:
boolean
// TODO
// TODO
declare
var
__uniRoutes
:
any
declare
var
__uniRoutes
:
any
declare
var
__uniConfig
:
UniApp
.
UniConfig
declare
var
__uniConfig
:
UniApp
.
UniConfig
...
...
packages/shims-uni-app.d.ts
浏览文件 @
76729422
...
@@ -10,10 +10,42 @@ declare namespace UniApp {
...
@@ -10,10 +10,42 @@ declare namespace UniApp {
router
:
{
router
:
{
strict
:
boolean
strict
:
boolean
}
}
globalStyle
:
{
navigationBar
:
PageNavigationBar
refreshOptions
?:
PageRefreshOptions
}
topWindow
?:
LayoutWindowOptions
topWindow
?:
LayoutWindowOptions
leftWindow
?:
LayoutWindowOptions
leftWindow
?:
LayoutWindowOptions
rightWindow
?:
LayoutWindowOptions
rightWindow
?:
LayoutWindowOptions
}
}
interface
PageNavigationBar
{
type
:
'
default
'
|
'
transparent
'
|
'
float
'
|
'
none
'
titleText
:
string
}
interface
PageRefreshOptions
{
support
:
boolean
color
:
string
style
:
'
circle
'
|
string
height
:
number
range
:
number
offset
:
number
}
interface
PageRouteMeta
{
id
:
number
isQuit
?:
boolean
isEntry
?:
boolean
isTabBar
?:
boolean
tabBarIndex
?:
number
windowTop
?:
number
topWindow
?:
boolean
leftWindow
?:
boolean
rightWindow
?:
boolean
enablePullDownRefresh
?:
boolean
navigationBar
:
PageNavigationBar
refreshOptions
?:
PageRefreshOptions
}
interface
PagesJsonPageOptions
{
interface
PagesJsonPageOptions
{
path
:
string
path
:
string
style
?:
Record
<
string
,
any
>
style
?:
Record
<
string
,
any
>
...
...
packages/uni-core/src/helpers/util.ts
浏览文件 @
76729422
export
function
PolySymbol
(
name
:
string
)
{
export
function
PolySymbol
(
name
:
string
)
{
return
Symbol
(
__DEV__
?
'
[uni-app]:
'
+
name
:
name
)
return
Symbol
(
__DEV__
?
'
[uni-app]:
'
+
name
:
name
)
}
}
export
function
rpx2px
(
str
:
string
|
number
)
{
if
(
typeof
str
===
'
string
'
)
{
const
res
=
parseInt
(
str
)
||
0
if
(
str
.
indexOf
(
'
rpx
'
)
!==
-
1
||
str
.
indexOf
(
'
upx
'
)
!==
-
1
)
{
return
uni
.
upx2px
(
res
)
}
return
res
}
return
str
}
packages/uni-h5/dist/assets/index-77a30187.css
0 → 100644
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-h5/dist/assets/index-81a48a08.css
0 → 100644
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-h5/dist/assets/index-bd45f813.css
0 → 100644
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-h5/dist/assets/index-e524b513.css
0 → 100644
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-h5/src/framework/components/page/index.ts
0 → 100644
浏览文件 @
76729422
import
{
withCtx
,
openBlock
,
renderSlot
,
createBlock
,
createVNode
,
SetupContext
,
defineComponent
,
}
from
'
vue
'
import
PageHead
from
'
./PageHead
'
import
PageBody
from
'
./PageBody
'
import
{
providePageMeta
}
from
'
../../plugin/provide
'
export
default
defineComponent
({
name
:
'
Page
'
,
setup
(
props
,
ctx
)
{
providePageMeta
()
return
()
=>
(
openBlock
(),
createBlock
(
'
uni-page
'
,
null
,
[
createPageHeadVNode
(),
createPageBodyVNode
(
ctx
),
])
)
},
})
function
createPageHeadVNode
()
{
return
createVNode
(
PageHead
)
}
function
createPageBodyVNode
(
ctx
:
SetupContext
)
{
return
(
openBlock
(),
createBlock
(
PageBody
,
{
key
:
1
},
{
default
:
withCtx
(()
=>
[
renderSlot
(
ctx
.
slots
,
'
page
'
)]),
_
:
3
/* FORWARDED */
,
}
)
)
}
packages/uni-h5/src/framework/components/page/index.vue
浏览文件 @
76729422
...
@@ -9,10 +9,10 @@
...
@@ -9,10 +9,10 @@
/>
/>
<page-body
<page-body
v-if=
"enablePullDownRefresh"
v-if=
"enablePullDownRefresh"
@
touchstart
.native
=
"_touchstart"
@
touchstart=
"_touchstart"
@
touchmove
.native
=
"_touchmove"
@
touchmove=
"_touchmove"
@
touchend
.native
=
"_touchend"
@
touchend=
"_touchend"
@
touchcancel
.native
=
"_touchend"
@
touchcancel=
"_touchend"
>
>
<slot
name=
"page"
/>
<slot
name=
"page"
/>
</page-body>
</page-body>
...
...
packages/uni-h5/src/framework/components/page/pageBody.ts
0 → 100644
浏览文件 @
76729422
import
{
ref
,
Fragment
,
openBlock
,
renderSlot
,
createBlock
,
createVNode
,
defineComponent
,
createCommentVNode
,
Ref
,
}
from
'
vue
'
import
{
usePageMeta
}
from
'
../../plugin/provide
'
import
PageRefresh
from
'
./pageRefresh/index.vue
'
import
{
usePageRefresh
}
from
'
./pageRefresh
'
export
default
defineComponent
({
name
:
'
PageBody
'
,
setup
(
props
,
ctx
)
{
const
pageMeta
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
?
usePageMeta
()
:
undefined
const
refreshRef
=
__UNI_FEATURE_PULL_DOWN_REFRESH__
?
ref
(
null
)
:
undefined
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
'
),
]),
]),
])
)
},
})
function
createPageRefreshVNode
(
refreshRef
:
Ref
,
pageMeta
:
UniApp
.
PageRouteMeta
)
{
if
(
!
__UNI_FEATURE_PULL_DOWN_REFRESH__
)
{
return
createCommentVNode
(
''
,
true
)
}
if
(
!
pageMeta
.
enablePullDownRefresh
)
{
return
createCommentVNode
(
''
,
true
)
}
return
createVNode
(
PageRefresh
,
{
ref
:
refreshRef
},
null
,
512
/* NEED_PATCH */
)
}
packages/uni-h5/src/framework/components/page/pageBody.vue
浏览文件 @
76729422
<
template
>
<
template
>
<div></div>
<uni-page-wrapper>
<uni-page-wrapper>
<uni-page-body>
<uni-page-body>
<slot
/>
<slot
/>
...
...
packages/uni-h5/src/framework/components/page/pageHead.ts
0 → 100644
浏览文件 @
76729422
import
{
createBlock
,
// createCommentVNode,
// createVNode,
defineComponent
,
openBlock
,
// renderSlot,
// SetupContext,
// withCtx,
}
from
'
vue
'
import
{
usePageMeta
}
from
'
../../plugin/provide
'
export
default
defineComponent
({
name
:
'
PageHead
'
,
setup
()
{
const
pageMeta
=
usePageMeta
()
return
()
=>
(
openBlock
(),
createBlock
(
'
uni-page-head
'
,
null
,
pageMeta
.
navigationBar
.
titleText
)
)
},
})
packages/uni-h5/src/framework/components/page/pageRefresh.vue
已删除
100644 → 0
浏览文件 @
2f1cf321
此差异已折叠。
点击以展开。
packages/uni-h5/src/framework/components/page/pageRefresh/index.ts
0 → 100644
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-h5/src/framework/components/page/pageRefresh/index.vue
0 → 100644
浏览文件 @
76729422
<
template
>
<uni-page-refresh>
<div
:style=
"
{ 'margin-top': offset + 'px' }" class="uni-page-refresh">
<div
class=
"uni-page-refresh-inner"
>
<svg
:fill=
"color"
class=
"uni-page-refresh__icon"
width=
"24"
height=
"24"
viewBox=
"0 0 24 24"
>
<path
d=
"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
/>
<path
d=
"M0 0h24v24H0z"
fill=
"none"
/>
</svg>
<svg
class=
"uni-page-refresh__spinner"
width=
"24"
height=
"24"
viewBox=
"25 25 50 50"
>
<circle
:stroke=
"color"
class=
"uni-page-refresh__path"
cx=
"50"
cy=
"50"
r=
"20"
fill=
"none"
stroke-width=
"4"
stroke-miterlimit=
"10"
/>
</svg>
</div>
</div>
</uni-page-refresh>
</
template
>
<
script
lang=
"ts"
>
import
{
usePageMeta
}
from
'
../../../plugin/provide
'
export
default
{
name
:
'
PageRefresh
'
,
setup
()
{
const
{
refreshOptions
}
=
usePageMeta
()
return
{
offset
:
refreshOptions
!
.
offset
,
color
:
refreshOptions
!
.
color
,
}
},
}
</
script
>
packages/uni-h5/src/framework/plugin/index.ts
浏览文件 @
76729422
...
@@ -7,7 +7,6 @@ import { isCustomElement } from '@dcloudio/uni-shared'
...
@@ -7,7 +7,6 @@ import { isCustomElement } from '@dcloudio/uni-shared'
import
{
initRouter
}
from
'
./router
'
import
{
initRouter
}
from
'
./router
'
import
{
initSystemComponents
}
from
'
./components
'
import
{
initSystemComponents
}
from
'
./components
'
import
{
initMixin
}
from
'
./mixin
'
import
{
initMixin
}
from
'
./mixin
'
import
{
initProvide
}
from
'
./provide
'
export
default
{
export
default
{
install
(
app
:
App
)
{
install
(
app
:
App
)
{
...
@@ -19,6 +18,9 @@ export default {
...
@@ -19,6 +18,9 @@ export default {
initSystemComponents
(
app
)
initSystemComponents
(
app
)
initMixin
(
app
)
initMixin
(
app
)
initProvide
(
app
,
(
__UNI_FEATURE_PAGES__
&&
initRouter
(
app
))
||
undefined
)
if
(
__UNI_FEATURE_PAGES__
)
{
initRouter
(
app
)
}
},
},
}
}
packages/uni-h5/src/framework/plugin/page.ts
浏览文件 @
76729422
import
{
import
{
computed
,
nextTick
,
VNode
,
ComponentPublicInstance
}
from
'
vue
'
computed
,
nextTick
,
VNode
,
ComponentPublicInstance
,
ComputedRef
,
}
from
'
vue
'
import
{
useRoute
,
RouteLocationNormalizedLoaded
}
from
'
vue-router
'
import
{
useRoute
,
RouteLocationNormalizedLoaded
}
from
'
vue-router
'
const
SEP
=
'
$$
'
const
SEP
=
'
$$
'
...
...
packages/uni-h5/src/framework/plugin/provide/index.ts
浏览文件 @
76729422
import
{
App
}
from
'
vue
'
export
*
from
'
./page
'
import
{
Router
}
from
'
vue-router
'
export
*
from
'
./layout
'
import
{
PolySymbol
}
from
'
@dcloudio/uni-core
'
import
{
initLayout
}
from
'
./layout
'
const
layoutKey
=
PolySymbol
(
__DEV__
?
'
layout
'
:
'
l
'
)
export
function
initProvide
(
app
:
App
,
router
?:
Router
)
{
app
.
provide
(
layoutKey
,
initLayout
(
router
))
}
packages/uni-h5/src/framework/plugin/provide/layout.ts
浏览文件 @
76729422
import
{
computed
,
nextTick
,
Ref
,
ref
}
from
'
vue
'
import
{
computed
,
inject
,
nextTick
,
provide
,
Ref
,
ref
}
from
'
vue
'
import
{
Router
}
from
'
vue-router
'
import
{
Router
}
from
'
vue-router
'
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
RESPONSIVE_MIN_WIDTH
}
from
'
@dcloudio/uni-shared
'
import
{
RESPONSIVE_MIN_WIDTH
}
from
'
@dcloudio/uni-shared
'
import
{
PolySymbol
}
from
'
@dcloudio/uni-core
'
import
{
checkMinWidth
}
from
'
../../../helpers/dom
'
import
{
checkMinWidth
}
from
'
../../../helpers/dom
'
const
layoutKey
=
PolySymbol
(
__DEV__
?
'
layout
'
:
'
l
'
)
interface
ProvideLayout
{}
interface
ProvideLayout
{}
// const windowTypes = ['top', 'left', 'right']
// const windowTypes = ['top', 'left', 'right']
export
function
useLayout
()
{
return
inject
(
layoutKey
)
}
export
function
provideLayout
(
router
?:
Router
)
{
provide
(
layoutKey
,
initLayout
(
router
))
}
// 1. 查找minWidth,确认是否需要responsive
// 1. 查找minWidth,确认是否需要responsive
export
function
initLayout
(
router
?:
Router
):
ProvideLayout
{
function
initLayout
(
router
?:
Router
):
ProvideLayout
{
if
(
!
__UNI_FEATURE_RESPONSIVE__
)
{
if
(
!
__UNI_FEATURE_RESPONSIVE__
)
{
return
{}
return
{}
}
}
...
...
packages/uni-h5/src/framework/plugin/provide/page.ts
0 → 100644
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-h5/src/framework/plugin/router.ts
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-h5/src/index.ts
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-mp-vue/src/plugin.ts
浏览文件 @
76729422
import
{
App
}
from
'
@vue/runtime-cor
e
'
import
{
App
}
from
'
vu
e
'
import
{
initApp
}
from
'
@dcloudio/uni-vue
'
import
{
initApp
}
from
'
@dcloudio/uni-vue
'
...
...
packages/uni-vue/src/apiLifecycle.ts
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-vue/src/appConfig.ts
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-vue/src/componentInstance.ts
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-vue/src/componentOptions.ts
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/uni-vue/src/index.ts
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/vite-plugin-uni/package.json
浏览文件 @
76729422
此差异已折叠。
点击以展开。
packages/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
浏览文件 @
76729422
此差异已折叠。
点击以展开。
tsconfig.json
浏览文件 @
76729422
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录