Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
菜鸟程序猿_c
uni-app
提交
bc25bf5e
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,发现更多精彩内容 >>
提交
bc25bf5e
编写于
8月 18, 2021
作者:
inkwalk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(app): mediaQueryObserver
上级
fab3f14d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
94 addition
and
21 deletion
+94
-21
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+25
-4
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+1
-1
packages/uni-app-plus/src/platform/index.ts
packages/uni-app-plus/src/platform/index.ts
+5
-13
packages/uni-app-plus/src/service/api/ui/mediaQueryObserver.ts
...ges/uni-app-plus/src/service/api/ui/mediaQueryObserver.ts
+42
-0
packages/uni-app-plus/src/view/framework/viewMethods.ts
packages/uni-app-plus/src/view/framework/viewMethods.ts
+14
-0
packages/uni-h5/src/service/api/ui/mediaQueryObserver.ts
packages/uni-h5/src/service/api/ui/mediaQueryObserver.ts
+2
-2
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+5
-1
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
bc25bf5e
...
...
@@ -2229,12 +2229,12 @@ var serviceContext = (function (vue) {
}, pageId, operateMapCallback);
}
function getEventName(reqId) {
function getEventName
$1
(reqId) {
const EVENT_NAME = 'IntersectionObserver';
return `${EVENT_NAME}.${reqId}`;
}
function addIntersectionObserver({ reqId, component, options, callback }, _pageId) {
const eventName = getEventName(reqId);
const eventName = getEventName
$1
(reqId);
UniServiceJSBridge.invokeViewMethod('addIntersectionObserver', {
reqId,
component: component.$el.nodeId,
...
...
@@ -2248,11 +2248,32 @@ var serviceContext = (function (vue) {
reqId,
component: component.$el.nodeId,
}, _pageId);
UniServiceJSBridge.unsubscribe(getEventName$1(reqId));
}
function getEventName(reqId) {
const EVENT_NAME = 'MediaQueryObserver';
return `${EVENT_NAME}.${reqId}`;
}
function addMediaQueryObserver({ reqId, component, options, callback }, _pageId) {
const eventName = getEventName(reqId);
UniServiceJSBridge.invokeViewMethod('addMediaQueryObserver', {
reqId,
component: component.$el.nodeId,
options,
eventName,
}, _pageId);
UniServiceJSBridge.subscribe(eventName, callback);
}
function removeMediaQueryObserver({ reqId, component }, _pageId) {
UniServiceJSBridge.invokeViewMethod('removeMediaQueryObserver', {
reqId,
component: component.$el.nodeId,
// reqEnd: true
}, _pageId);
UniServiceJSBridge.unsubscribe(getEventName(reqId));
}
function addMediaQueryObserver(args, pageId) { }
function removeMediaQueryObserver(args, pageId) { }
const TEMP_PATH$1 = '';
const API_UPX2PX = 'upx2px';
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
bc25bf5e
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
packages/uni-app-plus/src/platform/index.ts
浏览文件 @
bc25bf5e
import
{
AddMediaQueryObserverArgs
,
RemoveMediaQueryObserverArgs
,
}
from
'
@dcloudio/uni-api
'
export
{
getBaseSystemInfo
}
from
'
../service/api/base/getBaseSystemInfo
'
export
{
requestComponentInfo
}
from
'
../service/api/ui/requestComponentInfo
'
export
{
getRealPath
}
from
'
./getRealPath
'
...
...
@@ -14,14 +9,11 @@ export {
removeIntersectionObserver
,
}
from
'
../service/api/ui/intersectionObserver
'
export
function
addMediaQueryObserver
(
args
:
AddMediaQueryObserverArgs
,
pageId
:
number
)
{}
export
function
removeMediaQueryObserver
(
args
:
RemoveMediaQueryObserverArgs
,
pageId
:
number
)
{}
export
{
addMediaQueryObserver
,
removeMediaQueryObserver
,
}
from
'
../service/api/ui/mediaQueryObserver
'
export
function
saveImage
(
base64
:
string
,
dirname
:
string
,
...
...
packages/uni-app-plus/src/service/api/ui/mediaQueryObserver.ts
0 → 100644
浏览文件 @
bc25bf5e
import
{
AddMediaQueryObserverArgs
,
RemoveMediaQueryObserverArgs
,
}
from
'
@dcloudio/uni-api
'
function
getEventName
(
reqId
:
number
)
{
const
EVENT_NAME
=
'
MediaQueryObserver
'
return
`
${
EVENT_NAME
}
.
${
reqId
}
`
}
export
function
addMediaQueryObserver
(
{
reqId
,
component
,
options
,
callback
}:
AddMediaQueryObserverArgs
,
_pageId
:
number
)
{
const
eventName
=
getEventName
(
reqId
)
UniServiceJSBridge
.
invokeViewMethod
(
'
addMediaQueryObserver
'
,
{
reqId
,
component
:
component
.
$el
.
nodeId
,
options
,
eventName
,
},
_pageId
)
UniServiceJSBridge
.
subscribe
(
eventName
,
callback
)
}
export
function
removeMediaQueryObserver
(
{
reqId
,
component
}:
RemoveMediaQueryObserverArgs
,
_pageId
:
number
)
{
UniServiceJSBridge
.
invokeViewMethod
(
'
removeMediaQueryObserver
'
,
{
reqId
,
component
:
component
.
$el
.
nodeId
,
},
_pageId
)
UniServiceJSBridge
.
unsubscribe
(
getEventName
(
reqId
))
}
packages/uni-app-plus/src/view/framework/viewMethods.ts
浏览文件 @
bc25bf5e
...
...
@@ -14,6 +14,8 @@ import { requestComponentInfo } from '../../../../uni-h5/src/platform'
import
{
addIntersectionObserver
,
removeIntersectionObserver
,
addMediaQueryObserver
,
removeMediaQueryObserver
,
}
from
'
../../../../uni-h5/src/platform
'
import
{
loadFontFace
}
from
'
./dom/font
'
...
...
@@ -49,6 +51,18 @@ export function initViewMethods() {
registerViewMethod
(
pageId
,
'
removeIntersectionObserver
'
,
(
args
)
=>
{
removeIntersectionObserver
(
args
)
})
registerViewMethod
(
pageId
,
'
addMediaQueryObserver
'
,
(
args
)
=>
{
addMediaQueryObserver
(
extend
({},
args
,
{
callback
(
res
:
any
)
{
UniViewJSBridge
.
publishHandler
(
args
.
eventName
,
res
)
},
})
)
})
registerViewMethod
(
pageId
,
'
removeMediaQueryObserver
'
,
(
args
)
=>
{
removeMediaQueryObserver
(
args
)
})
registerViewMethod
(
pageId
,
API_PAGE_SCROLL_TO
,
pageScrollTo
)
registerViewMethod
(
pageId
,
API_LOAD_FONT_FACE
,
loadFontFace
)
}
packages/uni-h5/src/service/api/ui/mediaQueryObserver.ts
浏览文件 @
bc25bf5e
...
...
@@ -45,7 +45,7 @@ function humpToLine(name: string) {
// 请求媒体查询对象
export
function
addMediaQueryObserver
(
{
reqId
,
component
,
options
,
callback
}:
AddMediaQueryObserverArgs
,
_pageId
:
number
_pageId
?
:
number
)
{
// 创建一个媒体查询对象
const
mediaQueryObserver
=
(
mediaQueryObservers
[
reqId
]
=
window
.
matchMedia
(
...
...
@@ -61,7 +61,7 @@ export function addMediaQueryObserver(
// 销毁媒体查询对象
export
function
removeMediaQueryObserver
(
{
reqId
,
component
}:
RemoveMediaQueryObserverArgs
,
_pageId
:
number
_pageId
?
:
number
)
{
const
listener
=
listeners
[
reqId
]
const
mediaQueryObserver
=
mediaQueryObservers
[
reqId
]
...
...
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
bc25bf5e
...
...
@@ -4044,7 +4044,7 @@ function createVueApp(rootComponent, rootProps = null) {
function
withModifiers
()
{
}
function
createVNode$1
()
{
}
function
applyOption
s
(
options
,
instance
,
publicThis
)
{
function
initHook
s
(
options
,
instance
,
publicThis
)
{
options
.
mpType
||
publicThis
.
$mpType
;
// 为了组件也可以监听部分生命周期,故不再判断mpType,统一添加on开头的生命周期
Object
.
keys
(
options
).
forEach
((
name
)
=>
{
...
...
@@ -4057,6 +4057,10 @@ function applyOptions(options, instance, publicThis) {
});
}
function
applyOptions
(
options
,
instance
,
publicThis
)
{
initHooks
(
options
,
instance
,
publicThis
);
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录