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

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

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