Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ripplebb
uni-app
提交
e65a042d
U
uni-app
项目概览
ripplebb
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e65a042d
编写于
10月 26, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(v): createMapContext
上级
65f4918c
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
320 addition
and
124 deletion
+320
-124
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+146
-54
src/core/service/api/context/create-map-context.js
src/core/service/api/context/create-map-context.js
+92
-0
src/core/service/api/ui/create-intersection-observer.js
src/core/service/api/ui/create-intersection-observer.js
+8
-10
src/core/service/api/ui/create-selector-query.js
src/core/service/api/ui/create-selector-query.js
+4
-7
src/core/service/platform.js
src/core/service/platform.js
+10
-0
src/platforms/app-plus-nvue/service/api/context/map.js
src/platforms/app-plus-nvue/service/api/context/map.js
+0
-47
src/platforms/app-plus-nvue/service/api/context/operate-map-player.js
...s/app-plus-nvue/service/api/context/operate-map-player.js
+30
-0
src/platforms/app-plus-nvue/service/api/util.js
src/platforms/app-plus-nvue/service/api/util.js
+6
-2
src/platforms/app-plus/service/api/context/operate-map-player.js
...tforms/app-plus/service/api/context/operate-map-player.js
+12
-0
src/platforms/app-plus/service/api/ui/request-component-info.js
...atforms/app-plus/service/api/ui/request-component-info.js
+4
-4
src/platforms/h5/service/api/context/operate-map-player.js
src/platforms/h5/service/api/context/operate-map-player.js
+8
-0
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
e65a042d
...
...
@@ -7256,10 +7256,10 @@ var serviceContext = (function () {
});
}
function
requestComponentInfo$2
(
page
Instance
,
queue
,
callback
)
{
page
Instance
.
$page
.
meta
.
isNVue
?
requestComponentInfo$1
(
page
Instance
,
queue
,
callback
)
:
requestComponentInfo
(
page
Instance
,
queue
,
callback
);
function
requestComponentInfo$2
(
page
Vm
,
queue
,
callback
)
{
page
Vm
.
$page
.
meta
.
isNVue
?
requestComponentInfo$1
(
page
Vm
,
queue
,
callback
)
:
requestComponentInfo
(
page
Vm
,
queue
,
callback
);
}
...
...
@@ -7427,6 +7427,16 @@ var serviceContext = (function () {
*/
function
onMethod
(
name
,
callback
)
{
return
UniServiceJSBridge
.
on
(
'
api.
'
+
name
,
callback
)
}
function
getCurrentPageVm
(
method
)
{
const
pages
=
getCurrentPages
();
const
len
=
pages
.
length
;
if
(
!
len
)
{
UniServiceJSBridge
.
emit
(
'
onError
'
,
`
${
method
}
:fail`
);
}
const
page
=
pages
[
len
-
1
];
return
page
.
$vm
}
const
eventNames
=
[
...
...
@@ -7737,6 +7747,98 @@ var serviceContext = (function () {
getBackgroundAudioManager
:
getBackgroundAudioManager
});
function
operateMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
{
invokeMethod
(
'
operateMapPlayer
'
,
mapId
,
pageVm
,
type
,
data
);
}
class
MapContext
{
constructor
(
id
,
pageVm
)
{
this
.
id
=
id
;
this
.
pageVm
=
pageVm
;
}
getCenterLocation
({
success
,
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getCenterLocation
'
,
{
success
,
fail
,
complete
});
}
moveToLocation
()
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
moveToLocation
'
);
}
translateMarker
({
markerId
,
destination
,
autoRotate
,
rotate
,
duration
,
animationEnd
,
fail
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
translateMarker
'
,
{
markerId
,
destination
,
autoRotate
,
rotate
,
duration
,
animationEnd
,
fail
});
}
includePoints
({
points
,
padding
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
includePoints
'
,
{
points
,
padding
});
}
getRegion
({
success
,
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getRegion
'
,
{
success
,
fail
,
complete
});
}
getScale
({
success
,
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getScale
'
,
{
success
,
fail
,
complete
});
}
}
function
createMapContext$1
(
id
,
context
)
{
if
(
context
)
{
return
new
MapContext
(
id
,
context
)
}
return
new
MapContext
(
id
,
getCurrentPageVm
(
'
createMapContext
'
))
}
var
require_context_module_1_6
=
/*#__PURE__*/
Object
.
freeze
({
createMapContext
:
createMapContext$1
});
const
callbacks$3
=
[];
onMethod
(
'
onAccelerometerChange
'
,
function
(
res
)
{
...
...
@@ -7777,7 +7879,7 @@ var serviceContext = (function () {
})
}
var
require_context_module_1_
6
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
7
=
/*#__PURE__*/
Object
.
freeze
({
onAccelerometerChange
:
onAccelerometerChange
,
startAccelerometer
:
startAccelerometer
,
stopAccelerometer
:
stopAccelerometer
...
...
@@ -7800,7 +7902,7 @@ var serviceContext = (function () {
const
onBLEConnectionStateChange$1
=
on
(
'
onBLEConnectionStateChange
'
);
const
onBLECharacteristicValueChange$1
=
on
(
'
onBLECharacteristicValueChange
'
);
var
require_context_module_1_
7
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
8
=
/*#__PURE__*/
Object
.
freeze
({
onBluetoothDeviceFound
:
onBluetoothDeviceFound$1
,
onBluetoothAdapterStateChange
:
onBluetoothAdapterStateChange$1
,
onBLEConnectionStateChange
:
onBLEConnectionStateChange$1
,
...
...
@@ -7847,7 +7949,7 @@ var serviceContext = (function () {
})
}
var
require_context_module_1_
8
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
9
=
/*#__PURE__*/
Object
.
freeze
({
onCompassChange
:
onCompassChange
,
startCompass
:
startCompass
,
stopCompass
:
stopCompass
...
...
@@ -7865,7 +7967,7 @@ var serviceContext = (function () {
callbacks$5
.
push
(
callbackId
);
}
var
require_context_module_1_
9
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
10
=
/*#__PURE__*/
Object
.
freeze
({
onNetworkStatusChange
:
onNetworkStatusChange
});
...
...
@@ -7942,7 +8044,7 @@ var serviceContext = (function () {
return
recorderManager
||
(
recorderManager
=
new
RecorderManager
())
}
var
require_context_module_1_1
0
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
1
=
/*#__PURE__*/
Object
.
freeze
({
getRecorderManager
:
getRecorderManager
});
...
...
@@ -8030,7 +8132,7 @@ var serviceContext = (function () {
return
task
}
var
require_context_module_1_1
1
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
2
=
/*#__PURE__*/
Object
.
freeze
({
downloadFile
:
downloadFile$1
});
...
...
@@ -8135,7 +8237,7 @@ var serviceContext = (function () {
return
new
RequestTask
(
requestTaskId
)
}
var
require_context_module_1_1
2
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
3
=
/*#__PURE__*/
Object
.
freeze
({
request
:
request$1
});
...
...
@@ -8309,7 +8411,7 @@ var serviceContext = (function () {
callbacks$7
.
close
=
callbackId
;
}
var
require_context_module_1_1
3
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
4
=
/*#__PURE__*/
Object
.
freeze
({
connectSocket
:
connectSocket$1
,
sendSocketMessage
:
sendSocketMessage$1
,
closeSocket
:
closeSocket$1
,
...
...
@@ -8403,7 +8505,7 @@ var serviceContext = (function () {
return
task
}
var
require_context_module_1_1
4
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
5
=
/*#__PURE__*/
Object
.
freeze
({
uploadFile
:
uploadFile$1
});
...
...
@@ -8512,7 +8614,7 @@ var serviceContext = (function () {
return
res
}
var
require_context_module_1_1
5
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
6
=
/*#__PURE__*/
Object
.
freeze
({
setStorage
:
setStorage$1
,
setStorageSync
:
setStorageSync$1
,
getStorage
:
getStorage$1
,
...
...
@@ -8603,7 +8705,7 @@ var serviceContext = (function () {
return
new
MPAnimation
(
option
)
}
var
require_context_module_1_1
6
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
7
=
/*#__PURE__*/
Object
.
freeze
({
createAnimation
:
createAnimation
});
...
...
@@ -8616,8 +8718,8 @@ var serviceContext = (function () {
};
class
ServiceIntersectionObserver
{
constructor
(
pageId
,
component
,
options
)
{
this
.
pageId
=
pageI
d
;
constructor
(
component
,
options
)
{
this
.
pageId
=
component
.
$page
.
i
d
;
this
.
component
=
component
.
_$id
||
component
;
// app-plus 平台传输_$id
this
.
options
=
Object
.
assign
({},
defaultOptions
,
options
);
}
...
...
@@ -8662,18 +8764,12 @@ var serviceContext = (function () {
context
=
null
;
}
if
(
context
)
{
return
new
ServiceIntersectionObserver
(
context
.
$page
.
id
,
context
,
options
)
}
const
pages
=
getCurrentPages
();
const
len
=
pages
.
length
;
if
(
!
len
)
{
UniServiceJSBridge
.
emit
(
'
onError
'
,
'
createIntersectionObserver:fail
'
);
return
new
ServiceIntersectionObserver
(
context
,
options
)
}
const
page
=
pages
[
len
-
1
];
return
new
ServiceIntersectionObserver
(
page
.
$page
.
id
,
page
.
$vm
,
options
)
return
new
ServiceIntersectionObserver
(
getCurrentPageVm
(
'
createIntersectionObserver
'
),
options
)
}
var
require_context_module_1_1
7
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
8
=
/*#__PURE__*/
Object
.
freeze
({
createIntersectionObserver
:
createIntersectionObserver
});
...
...
@@ -8778,15 +8874,10 @@ var serviceContext = (function () {
if
(
context
)
{
return
new
SelectorQuery
(
context
)
}
const
pages
=
getCurrentPages
();
const
len
=
pages
.
length
;
if
(
!
len
)
{
UniServiceJSBridge
.
emit
(
'
onError
'
,
'
createSelectorQuery:fail
'
);
}
return
new
SelectorQuery
(
pages
[
len
-
1
].
$vm
)
return
new
SelectorQuery
(
getCurrentPageVm
(
'
createSelectorQuery
'
))
}
var
require_context_module_1_1
8
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
9
=
/*#__PURE__*/
Object
.
freeze
({
createSelectorQuery
:
createSelectorQuery
});
...
...
@@ -8802,7 +8893,7 @@ var serviceContext = (function () {
callbacks$8
.
push
(
callbackId
);
}
var
require_context_module_1_
19
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
20
=
/*#__PURE__*/
Object
.
freeze
({
onKeyboardHeightChange
:
onKeyboardHeightChange
});
...
...
@@ -8814,7 +8905,7 @@ var serviceContext = (function () {
return
{}
}
var
require_context_module_1_2
0
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
1
=
/*#__PURE__*/
Object
.
freeze
({
pageScrollTo
:
pageScrollTo$1
});
...
...
@@ -8850,7 +8941,7 @@ var serviceContext = (function () {
callbacks$9
.
push
(
callbackId
);
}
var
require_context_module_1_2
1
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
2
=
/*#__PURE__*/
Object
.
freeze
({
removeTabBarBadge
:
removeTabBarBadge$1
,
showTabBarRedDot
:
showTabBarRedDot$1
,
hideTabBarRedDot
:
hideTabBarRedDot$1
,
...
...
@@ -8873,7 +8964,7 @@ var serviceContext = (function () {
callbacks$a
.
splice
(
callbacks$a
.
indexOf
(
callbackId
),
1
);
}
var
require_context_module_1_2
2
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
3
=
/*#__PURE__*/
Object
.
freeze
({
onWindowResize
:
onWindowResize
,
offWindowResize
:
offWindowResize
});
...
...
@@ -8889,23 +8980,24 @@ var serviceContext = (function () {
'
./base/upx2px.js
'
:
require_context_module_1_3
,
'
./context/audio.js
'
:
require_context_module_1_4
,
'
./context/background-audio.js
'
:
require_context_module_1_5
,
'
./device/accelerometer.js
'
:
require_context_module_1_6
,
'
./device/bluetooth.js
'
:
require_context_module_1_7
,
'
./device/compass.js
'
:
require_context_module_1_8
,
'
./device/network.js
'
:
require_context_module_1_9
,
'
./media/recorder.js
'
:
require_context_module_1_10
,
'
./network/download-file.js
'
:
require_context_module_1_11
,
'
./network/request.js
'
:
require_context_module_1_12
,
'
./network/socket.js
'
:
require_context_module_1_13
,
'
./network/upload-file.js
'
:
require_context_module_1_14
,
'
./storage/storage.js
'
:
require_context_module_1_15
,
'
./ui/create-animation.js
'
:
require_context_module_1_16
,
'
./ui/create-intersection-observer.js
'
:
require_context_module_1_17
,
'
./ui/create-selector-query.js
'
:
require_context_module_1_18
,
'
./ui/keyboard.js
'
:
require_context_module_1_19
,
'
./ui/page-scroll-to.js
'
:
require_context_module_1_20
,
'
./ui/tab-bar.js
'
:
require_context_module_1_21
,
'
./ui/window.js
'
:
require_context_module_1_22
,
'
./context/create-map-context.js
'
:
require_context_module_1_6
,
'
./device/accelerometer.js
'
:
require_context_module_1_7
,
'
./device/bluetooth.js
'
:
require_context_module_1_8
,
'
./device/compass.js
'
:
require_context_module_1_9
,
'
./device/network.js
'
:
require_context_module_1_10
,
'
./media/recorder.js
'
:
require_context_module_1_11
,
'
./network/download-file.js
'
:
require_context_module_1_12
,
'
./network/request.js
'
:
require_context_module_1_13
,
'
./network/socket.js
'
:
require_context_module_1_14
,
'
./network/upload-file.js
'
:
require_context_module_1_15
,
'
./storage/storage.js
'
:
require_context_module_1_16
,
'
./ui/create-animation.js
'
:
require_context_module_1_17
,
'
./ui/create-intersection-observer.js
'
:
require_context_module_1_18
,
'
./ui/create-selector-query.js
'
:
require_context_module_1_19
,
'
./ui/keyboard.js
'
:
require_context_module_1_20
,
'
./ui/page-scroll-to.js
'
:
require_context_module_1_21
,
'
./ui/tab-bar.js
'
:
require_context_module_1_22
,
'
./ui/window.js
'
:
require_context_module_1_23
,
};
var
req
=
function
req
(
key
)
{
...
...
src/
platforms/h5/service/api/context/map
.js
→
src/
core/service/api/context/create-map-context
.js
浏览文件 @
e65a042d
function
operateMapPlayer
(
mapId
,
pageId
,
type
,
data
)
{
UniServiceJSBridge
.
publishHandler
(
pageId
+
'
-map-
'
+
mapId
,
{
mapId
,
type
,
data
},
pageId
)
import
{
invokeMethod
,
getCurrentPageVm
}
from
'
../../platform
'
function
operateMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
{
invokeMethod
(
'
operateMapPlayer
'
,
mapId
,
pageVm
,
type
,
data
)
}
class
MapContext
{
constructor
(
id
,
page
Id
)
{
constructor
(
id
,
page
Vm
)
{
this
.
id
=
id
this
.
page
Id
=
pageId
this
.
page
Vm
=
pageVm
}
getCenterLocation
({
...
...
@@ -17,15 +18,17 @@ class MapContext {
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
page
Id
,
'
getCenterLocation
'
,
{
operateMapPlayer
(
this
.
id
,
this
.
page
Vm
,
'
getCenterLocation
'
,
{
success
,
fail
,
complete
})
}
moveToLocation
()
{
operateMapPlayer
(
this
.
id
,
this
.
page
Id
,
'
moveToLocation
'
)
operateMapPlayer
(
this
.
id
,
this
.
page
Vm
,
'
moveToLocation
'
)
}
translateMarker
({
markerId
,
destination
,
...
...
@@ -35,7 +38,7 @@ class MapContext {
animationEnd
,
fail
})
{
operateMapPlayer
(
this
.
id
,
this
.
page
Id
,
'
translateMarker
'
,
{
operateMapPlayer
(
this
.
id
,
this
.
page
Vm
,
'
translateMarker
'
,
{
markerId
,
destination
,
autoRotate
,
...
...
@@ -45,32 +48,35 @@ class MapContext {
fail
})
}
includePoints
({
points
,
padding
})
{
operateMapPlayer
(
this
.
id
,
this
.
page
Id
,
'
includePoints
'
,
{
operateMapPlayer
(
this
.
id
,
this
.
page
Vm
,
'
includePoints
'
,
{
points
,
padding
})
}
getRegion
({
success
,
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
page
Id
,
'
getRegion
'
,
{
operateMapPlayer
(
this
.
id
,
this
.
page
Vm
,
'
getRegion
'
,
{
success
,
fail
,
complete
})
}
getScale
({
success
,
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
page
Id
,
'
getScale
'
,
{
operateMapPlayer
(
this
.
id
,
this
.
page
Vm
,
'
getScale
'
,
{
success
,
fail
,
complete
...
...
@@ -80,12 +86,7 @@ class MapContext {
export
function
createMapContext
(
id
,
context
)
{
if
(
context
)
{
return
new
MapContext
(
id
,
context
.
$page
.
id
)
return
new
MapContext
(
id
,
context
)
}
const
app
=
getApp
()
if
(
app
.
$route
&&
app
.
$route
.
params
.
__id__
)
{
return
new
MapContext
(
id
,
app
.
$route
.
params
.
__id__
)
}
else
{
UniServiceJSBridge
.
emit
(
'
onError
'
,
'
createMapContext:fail
'
)
}
}
return
new
MapContext
(
id
,
getCurrentPageVm
(
'
createMapContext
'
))
}
src/core/service/api/ui/create-intersection-observer.js
浏览文件 @
e65a042d
import
createCallbacks
from
'
uni-helpers/callbacks
'
import
{
getCurrentPageVm
}
from
'
../../platform
'
const
createIntersectionObserverCallbacks
=
createCallbacks
(
'
requestComponentObserver
'
)
const
defaultOptions
=
{
...
...
@@ -9,8 +13,8 @@ const defaultOptions = {
}
class
ServiceIntersectionObserver
{
constructor
(
pageId
,
component
,
options
)
{
this
.
pageId
=
pageI
d
constructor
(
component
,
options
)
{
this
.
pageId
=
component
.
$page
.
i
d
this
.
component
=
component
.
_$id
||
component
// app-plus 平台传输_$id
this
.
options
=
Object
.
assign
({},
defaultOptions
,
options
)
}
...
...
@@ -55,13 +59,7 @@ export function createIntersectionObserver (context, options) {
context
=
null
}
if
(
context
)
{
return
new
ServiceIntersectionObserver
(
context
.
$page
.
id
,
context
,
options
)
}
const
pages
=
getCurrentPages
()
const
len
=
pages
.
length
if
(
!
len
)
{
UniServiceJSBridge
.
emit
(
'
onError
'
,
'
createIntersectionObserver:fail
'
)
return
new
ServiceIntersectionObserver
(
context
,
options
)
}
const
page
=
pages
[
len
-
1
]
return
new
ServiceIntersectionObserver
(
page
.
$page
.
id
,
page
.
$vm
,
options
)
return
new
ServiceIntersectionObserver
(
getCurrentPageVm
(
'
createIntersectionObserver
'
),
options
)
}
src/core/service/api/ui/create-selector-query.js
浏览文件 @
e65a042d
import
{
isFn
}
from
'
uni-shared
'
import
{
invokeMethod
invokeMethod
,
getCurrentPageVm
}
from
'
../../platform
'
class
NodesRef
{
...
...
@@ -106,10 +108,5 @@ export function createSelectorQuery (context) {
if
(
context
)
{
return
new
SelectorQuery
(
context
)
}
const
pages
=
getCurrentPages
()
const
len
=
pages
.
length
if
(
!
len
)
{
UniServiceJSBridge
.
emit
(
'
onError
'
,
'
createSelectorQuery:fail
'
)
}
return
new
SelectorQuery
(
pages
[
len
-
1
].
$vm
)
return
new
SelectorQuery
(
getCurrentPageVm
(
'
createSelectorQuery
'
))
}
src/core/service/platform.js
浏览文件 @
e65a042d
...
...
@@ -13,4 +13,14 @@ export function invokeMethod (name, ...args) {
*/
export
function
onMethod
(
name
,
callback
)
{
return
UniServiceJSBridge
.
on
(
'
api.
'
+
name
,
callback
)
}
export
function
getCurrentPageVm
(
method
)
{
const
pages
=
getCurrentPages
()
const
len
=
pages
.
length
if
(
!
len
)
{
UniServiceJSBridge
.
emit
(
'
onError
'
,
`
${
method
}
:fail`
)
}
const
page
=
pages
[
len
-
1
]
return
page
.
$vm
}
src/platforms/app-plus-nvue/service/api/context/map.js
已删除
100644 → 0
浏览文件 @
65f4918c
import
{
findElmById
,
invokeVmMethod
,
invokeVmMethodWithoutArgs
}
from
'
../util
'
class
MapContext
{
constructor
(
id
,
ctx
)
{
this
.
id
=
id
this
.
ctx
=
ctx
}
getCenterLocation
(
cbs
)
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
getCenterLocation
'
,
cbs
)
}
moveToLocation
()
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
moveToLocation
'
)
}
translateMarker
(
args
)
{
return
invokeVmMethod
(
this
.
ctx
,
'
translateMarker
'
,
args
,
[
'
animationEnd
'
])
}
includePoints
(
args
)
{
return
invokeVmMethod
(
this
.
ctx
,
'
includePoints
'
,
args
)
}
getRegion
(
cbs
)
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
getRegion
'
,
cbs
)
}
getScale
(
cbs
)
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
getScale
'
,
cbs
)
}
}
export
function
createMapContext
(
id
,
vm
)
{
if
(
!
vm
)
{
return
console
.
warn
(
'
uni.createMapContext 必须传入第二个参数,即当前 vm 对象(this)
'
)
}
const
elm
=
findElmById
(
id
,
vm
)
if
(
!
elm
)
{
return
console
.
warn
(
'
Can not find `
'
+
id
+
'
`
'
)
}
return
new
MapContext
(
id
,
elm
)
}
src/platforms/app-plus-nvue/service/api/context/operate-map-player.js
0 → 100644
浏览文件 @
e65a042d
import
{
findElmById
,
invokeVmMethod
,
invokeVmMethodWithoutArgs
}
from
'
../util
'
const
METHODS
=
{
getCenterLocation
(
ctx
,
cbs
)
{
return
invokeVmMethodWithoutArgs
(
ctx
,
'
getCenterLocation
'
,
cbs
)
},
moveToLocation
(
ctx
)
{
return
invokeVmMethodWithoutArgs
(
ctx
,
'
moveToLocation
'
)
},
translateMarker
(
ctx
,
args
)
{
return
invokeVmMethod
(
ctx
,
'
translateMarker
'
,
args
,
[
'
animationEnd
'
])
},
includePoints
(
ctx
,
args
)
{
return
invokeVmMethod
(
ctx
,
'
includePoints
'
,
args
)
},
getRegion
(
ctx
,
cbs
)
{
return
invokeVmMethodWithoutArgs
(
ctx
,
'
getRegion
'
,
cbs
)
},
getScale
(
ctx
,
cbs
)
{
return
invokeVmMethodWithoutArgs
(
ctx
,
'
getScale
'
,
cbs
)
}
}
export
function
operateMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
{
return
METHODS
[
type
](
findElmById
(
mapId
,
pageVm
),
data
)
}
src/platforms/app-plus-nvue/service/api/util.js
浏览文件 @
e65a042d
...
...
@@ -46,7 +46,11 @@ export function invokeVmMethod (vm, method, args, extras) {
}
export
function
findElmById
(
id
,
vm
)
{
return
findRefByElm
(
id
,
vm
.
$el
)
const
elm
=
findRefByElm
(
id
,
vm
.
$el
)
if
(
!
elm
)
{
return
console
.
error
(
'
Can not find `
'
+
id
+
'
`
'
)
}
return
elm
}
function
findRefByElm
(
id
,
elm
)
{
...
...
@@ -108,4 +112,4 @@ function normalizeCallback (method, callbacks) {
isFn
(
complete
)
&&
complete
(
ret
)
}
}
}
}
src/platforms/app-plus/service/api/context/operate-map-player.js
0 → 100644
浏览文件 @
e65a042d
import
{
operateMapPlayer
as
operateVueMapPlayer
}
from
'
uni-platforms/h5/service/api/context/operate-map-player
'
import
{
operateMapPlayer
as
operateNVueMapPlayer
}
from
'
uni-platforms/app-plus-nvue/service/api/context/operate-map-player
'
export
function
operateMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
{
pageVm
.
$page
.
meta
.
isNVue
?
operateNVueMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
:
operateVueMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
}
src/platforms/app-plus/service/api/ui/request-component-info.js
浏览文件 @
e65a042d
...
...
@@ -6,8 +6,8 @@ import {
requestComponentInfo
as
requestNVueComponentInfo
}
from
'
uni-platforms/app-plus-nvue/service/api/ui/request-component-info
'
export
function
requestComponentInfo
(
page
Instance
,
queue
,
callback
)
{
page
Instance
.
$page
.
meta
.
isNVue
?
requestNVueComponentInfo
(
page
Instance
,
queue
,
callback
)
:
requestVueComponentInfo
(
page
Instance
,
queue
,
callback
)
export
function
requestComponentInfo
(
page
Vm
,
queue
,
callback
)
{
page
Vm
.
$page
.
meta
.
isNVue
?
requestNVueComponentInfo
(
page
Vm
,
queue
,
callback
)
:
requestVueComponentInfo
(
page
Vm
,
queue
,
callback
)
}
src/platforms/h5/service/api/context/operate-map-player.js
0 → 100644
浏览文件 @
e65a042d
export
function
operateMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
{
const
pageId
=
pageVm
.
$page
.
id
UniServiceJSBridge
.
publishHandler
(
pageId
+
'
-map-
'
+
mapId
,
{
mapId
,
type
,
data
},
pageId
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录