提交 fe23b60b 编写于 作者: d-u-a's avatar d-u-a

fix: map API getCenterLocation,getRegion 不回调的Bug

上级 f3a52261
......@@ -18,7 +18,7 @@ UniServiceJSBridge.subscribe('onMapMethodCallback', ({
callback.invoke(callbackId, data)
})
const methods = ['getCenterLocation', 'getScale', 'getRegion']
const methods = ['getCenterLocation', 'getScale', 'getRegion', 'includePoints', 'translateMarker']
export class MapContext {
constructor (id, pageVm) {
......@@ -29,14 +29,6 @@ export class MapContext {
moveToLocation () {
operateMapPlayer(this.id, this.pageVm, 'moveToLocation')
}
includePoints (args) {
operateMapPlayer(this.id, this.pageVm, 'includePoints', args)
}
translateMarker (args) {
operateMapPlayer(this.id, this.pageVm, 'translateMarker', args)
}
}
MapContext.prototype.$getAppMap = function () {
......@@ -45,10 +37,8 @@ MapContext.prototype.$getAppMap = function () {
methods.forEach(function (method) {
MapContext.prototype[method] = callback.warp(function (options, callbackId) {
operateMapPlayer(this.id, this.pageVm, method, {
options,
callbackId
})
options.callbackId = callbackId
operateMapPlayer(this.id, this.pageVm, method, options)
})
})
......
......@@ -4,6 +4,10 @@ import {
import initOn from 'uni-core/service/bridge/on'
import {
requireNativePlugin
} from '../bridge'
import {
NETWORK_TYPES
} from '../api/constants'
......@@ -55,6 +59,7 @@ export function getApp ({
}
function initGlobalListeners () {
const globalEvent = requireNativePlugin('globalEvent')
const emit = UniServiceJSBridge.emit
// splashclosed 时开始监听 backbutton
......@@ -84,7 +89,7 @@ function initGlobalListeners () {
})
})
plus.globalEvent.addEventListener('uistylechange', function (event) {
globalEvent.addEventListener('uistylechange', function (event) {
publish('onUIStyleChange', {
style: event.uistyle
})
......
......@@ -10,9 +10,10 @@ function warp (fn) {
complete: options.complete
}
const data = Object.assign({}, options)
delete data.success
delete data.fail
delete data.complete
// TODO 下版重构 nvue h5 callback
// delete data.success
// delete data.fail
// delete data.complete
const res = fn.bind(this)(data, callbackId)
if (res) {
invoke(callbackId, res)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册