Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yangkaifeng
uni-app
提交
2ae61779
U
uni-app
项目概览
yangkaifeng
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
3
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,发现更多精彩内容 >>
提交
2ae61779
编写于
10月 10, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add show|hide top|left|right window
上级
8fe2215e
变更
8
展开全部
显示空白变更内容
内联
并排
Showing
8 changed file
with
164 addition
and
15 deletion
+164
-15
lib/apis.js
lib/apis.js
+7
-1
packages/uni-h5/dist/index.css
packages/uni-h5/dist/index.css
+1
-1
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
packages/uni-h5/manifest.json
packages/uni-h5/manifest.json
+24
-0
src/platforms/h5/components/app/index.vue
src/platforms/h5/components/app/index.vue
+1
-0
src/platforms/h5/components/app/layout.vue
src/platforms/h5/components/app/layout.vue
+80
-12
src/platforms/h5/service/api/ui/windows.js
src/platforms/h5/service/api/ui/windows.js
+43
-0
src/shared/util.js
src/shared/util.js
+7
-0
未找到文件。
lib/apis.js
浏览文件 @
2ae61779
...
...
@@ -162,7 +162,13 @@ const ui = [
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
'
createMediaQueryObserver
'
,
'
getMenuButtonBoundingClientRect
'
'
getMenuButtonBoundingClientRect
'
,
'
showTopWindow
'
,
'
showLeftWindow
'
,
'
showRightWindow
'
,
'
hideTopWindow
'
,
'
hideLeftWindow
'
,
'
hideRightWindow
'
,
]
const
event
=
[
...
...
packages/uni-h5/dist/index.css
浏览文件 @
2ae61779
此差异已折叠。
点击以展开。
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
2ae61779
此差异已折叠。
点击以展开。
packages/uni-h5/manifest.json
浏览文件 @
2ae61779
...
...
@@ -741,6 +741,30 @@
]
]
],
"showTopWindow"
:
[
"/platforms/h5/service/api/ui/windows.js"
,
[]
],
"showLeftWindow"
:
[
"/platforms/h5/service/api/ui/windows.js"
,
[]
],
"showRightWindow"
:
[
"/platforms/h5/service/api/ui/windows.js"
,
[]
],
"hideTopWindow"
:
[
"/platforms/h5/service/api/ui/windows.js"
,
[]
],
"hideLeftWindow"
:
[
"/platforms/h5/service/api/ui/windows.js"
,
[]
],
"hideRightWindow"
:
[
"/platforms/h5/service/api/ui/windows.js"
,
[]
],
"$emit"
:
[
"/platforms/h5/service/api/base/event-bus.js"
,
[
...
...
src/platforms/h5/components/app/index.vue
浏览文件 @
2ae61779
<
template
>
<uni-app
:class=
"
{'uni-app--showtabbar':showTabBar}">
<layout
ref=
"layout"
:router-key=
"key"
:keep-alive-include=
"keepAliveInclude"
/>
...
...
src/platforms/h5/components/app/layout.vue
浏览文件 @
2ae61779
...
...
@@ -5,7 +5,7 @@
>
<uni-top-window
v-if=
"topWindow"
v-show=
"showTopWindow"
v-show=
"showTopWindow
|| apiShowTopWindow
"
>
<div
ref=
"topWindow"
...
...
@@ -30,25 +30,41 @@
</uni-main>
<uni-left-window
v-if=
"leftWindow"
v-show=
"showLeftWindow"
v-show=
"showLeftWindow
|| apiShowLeftWindow
"
ref=
"leftWindow"
:data-show=
"apiShowLeftWindow"
:style=
"leftWindowStyle"
>
<div
v-if=
"apiShowLeftWindow"
class=
"uni-mask"
@
click=
"apiShowLeftWindow = false"
/>
<div
class=
"uni-left-window"
>
<v-uni-left-window
ref=
"left"
@
hook:mounted=
"onLeftWindowInit"
/>
</div>
</uni-left-window>
<uni-right-window
v-if=
"rightWindow"
v-show=
"showRightWindow"
v-show=
"showRightWindow
|| apiShowRightWindow
"
ref=
"rightWindow"
:data-show=
"apiShowRightWindow"
:style=
"rightWindowStyle"
>
<div
v-if=
"apiShowRightWindow"
class=
"uni-mask"
@
click=
"apiShowRightWindow = false"
/>
<div
class=
"uni-right-window"
>
<v-uni-right-window
ref=
"right"
@
hook:mounted=
"onRightWindowInit"
/>
</div>
</uni-right-window>
</uni-content>
<!--TODO footer-->
...
...
@@ -65,7 +81,8 @@
import
Vue
from
'
vue
'
import
{
hasOwn
hasOwn
,
capitalize
}
from
'
uni-shared
'
import
{
...
...
@@ -119,7 +136,10 @@ export default {
topWindowMediaQuery
:
false
,
leftWindowMediaQuery
:
false
,
rightWindowMediaQuery
:
false
,
topWindowHeight
:
'
0px
'
topWindowHeight
:
'
0px
'
,
apiShowTopWindow
:
false
,
apiShowLeftWindow
:
false
,
apiShowRightWindow
:
false
}
},
computed
:
{
...
...
@@ -127,12 +147,15 @@ export default {
return
this
.
showTopWindow
||
this
.
showLeftWindow
||
this
.
showRightWindow
},
showTopWindow
()
{
this
.
resetApiShowWindow
()
return
this
.
$route
.
meta
.
topWindow
!==
false
&&
this
.
topWindowMediaQuery
},
showLeftWindow
()
{
this
.
resetApiShowWindow
()
return
this
.
$route
.
meta
.
leftWindow
!==
false
&&
this
.
leftWindowMediaQuery
},
showRightWindow
()
{
this
.
resetApiShowWindow
()
return
this
.
$route
.
meta
.
rightWindow
!==
false
&&
this
.
rightWindowMediaQuery
}
},
...
...
@@ -190,6 +213,31 @@ export default {
}
},
methods
:
{
resetApiShowWindow
()
{
// 仅对 left,right 重置
// this.apiShowTopWindow = false
this
.
apiShowLeftWindow
=
false
this
.
apiShowRightWindow
=
false
},
showWindow
(
type
,
show
=
true
)
{
if
(
!
this
[
type
+
'
Window
'
])
{
return
type
+
'
Window not found
'
}
const
fType
=
capitalize
(
type
)
if
(
!
this
[
'
show
'
+
fType
+
'
Window
'
])
{
// 小屏下
const
apiShowName
=
'
apiShow
'
+
fType
+
'
Window
'
if
(
this
[
apiShowName
]
!==
show
)
{
this
[
apiShowName
]
=
show
if
(
type
===
'
top
'
)
{
// 特殊处理 top
if
(
show
)
{
this
.
$nextTick
(
this
.
onTopWindowInit
)
}
else
{
updateCssVar
(
'
--window-top
'
,
'
0px
'
)
}
}
}
}
},
initWindowMinWidth
(
type
)
{
const
name
=
type
+
'
Window
'
if
(
this
[
name
])
{
...
...
@@ -211,7 +259,7 @@ export default {
mediaQueryList
.
addListener
((
e
)
=>
{
this
[
name
]
=
e
.
matches
this
.
$nextTick
(()
=>
{
this
[
'
on
'
+
(
type
.
substr
(
0
,
1
).
toUpperCase
()
+
type
.
substr
(
1
)
)
+
'
WindowInit
'
]()
this
[
'
on
'
+
capitalize
(
type
)
+
'
WindowInit
'
]()
})
})
this
[
name
]
=
mediaQueryList
.
matches
...
...
@@ -283,6 +331,26 @@ export default {
overflow-x
:
hidden
;
}
uni-left-window
[
data-show
],
uni-right-window
[
data-show
]
{
position
:
absolute
;
}
uni-right-window
[
data-show
]
{
right
:
0
;
}
uni-content
.uni-mask
,
.uni-left-window
,
.uni-right-window
{
z-index
:
997
;
}
.uni-mask
+
.uni-left-window
,
.uni-mask
+
.uni-right-window
{
position
:
absolute
;
}
.uni-app--showlayout
+
uni-tabbar
{
display
:
none
;
}
...
...
src/platforms/h5/service/api/ui/windows.js
0 → 100644
浏览文件 @
2ae61779
import
{
capitalize
}
from
'
uni-shared
'
function
showWindow
(
type
,
show
)
{
const
api
=
show
?
'
show
'
:
'
hide
'
+
capitalize
(
type
)
+
'
Window
'
const
app
=
getApp
()
if
(
app
)
{
const
msg
=
app
.
$children
[
0
].
$refs
.
layout
.
showWindow
(
type
,
show
)
if
(
msg
)
{
return
{
errMsg
:
`
${
api
}
:fail
${
msg
}
`
}
}
return
{}
}
return
{
errMsg
:
`
${
api
}
:fail app not ready`
}
}
export
function
showTopWindow
()
{
return
showWindow
(
'
top
'
,
true
)
}
export
function
hideTopWindow
()
{
return
showWindow
(
'
top
'
,
false
)
}
export
function
showLeftWindow
()
{
return
showWindow
(
'
left
'
,
true
)
}
export
function
hideLeftWindow
()
{
return
showWindow
(
'
left
'
,
false
)
}
export
function
showRightWindow
()
{
return
showWindow
(
'
right
'
,
true
)
}
export
function
hideRightWindow
()
{
return
showWindow
(
'
right
'
,
false
)
}
src/shared/util.js
浏览文件 @
2ae61779
...
...
@@ -50,6 +50,13 @@ export const camelize = cached((str) => {
return
str
.
replace
(
camelizeRE
,
(
_
,
c
)
=>
c
?
c
.
toUpperCase
()
:
''
)
})
/**
* Capitalize a string.
*/
export
const
capitalize
=
cached
((
str
)
=>
{
return
str
.
charAt
(
0
).
toUpperCase
()
+
str
.
slice
(
1
)
})
export
function
setProperties
(
item
,
props
,
propsData
)
{
props
.
forEach
(
function
(
name
)
{
if
(
hasOwn
(
propsData
,
name
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录