提交 0249de45 编写于 作者: fxy060608's avatar fxy060608

fix(mp): mp-alipay map 事件转换

上级 f5dae4e6
...@@ -17,7 +17,8 @@ import { ...@@ -17,7 +17,8 @@ import {
triggerEvent, triggerEvent,
createObserver, createObserver,
isComponent2, isComponent2,
initChildVues initChildVues,
initSpecialEvents
} from './util' } from './util'
function initVm (VueComponent) { function initVm (VueComponent) {
...@@ -118,8 +119,7 @@ export default function parseComponent (vueComponentOptions) { ...@@ -118,8 +119,7 @@ export default function parseComponent (vueComponentOptions) {
componentOptions.didUpdate = createObserver(true) componentOptions.didUpdate = createObserver(true)
} }
if (vueOptions.methods && vueOptions.methods.formReset) { initSpecialEvents(componentOptions.methods, vueOptions.methods)
componentOptions.methods.formReset = vueOptions.methods.formReset
}
return componentOptions return componentOptions
} }
...@@ -13,7 +13,8 @@ import { ...@@ -13,7 +13,8 @@ import {
handleRef, handleRef,
handleLink, handleLink,
initBehavior, initBehavior,
initChildVues initChildVues,
initSpecialEvents
} from './util' } from './util'
const hooks = [ const hooks = [
...@@ -69,9 +70,7 @@ export default function parsePage (vuePageOptions) { ...@@ -69,9 +70,7 @@ export default function parsePage (vuePageOptions) {
initHooks(pageOptions, hooks) initHooks(pageOptions, hooks)
if (vueOptions.methods && vueOptions.methods.formReset) { initSpecialEvents(pageOptions.methods, vueOptions.methods)
pageOptions.formReset = vueOptions.methods.formReset
}
return pageOptions return pageOptions
} }
...@@ -42,6 +42,25 @@ export function initRelation (detail) { ...@@ -42,6 +42,25 @@ export function initRelation (detail) {
this.props.onVueInit(detail) this.props.onVueInit(detail)
} }
const SPECIAL_EVENTS = [
'formReset',
'markerTap',
'calloutTap',
'controlTap',
'regionChange'
]
export function initSpecialEvents (mpMethods, vueMethods) {
if (!vueMethods) {
return
}
SPECIAL_EVENTS.forEach((name) => {
if (vueMethods[name]) {
mpMethods[name] = vueMethods[name]
}
})
}
export function initChildVues (mpInstance) { export function initChildVues (mpInstance) {
// 此时需保证当前 mpInstance 已经存在 $vm // 此时需保证当前 mpInstance 已经存在 $vm
if (!mpInstance.$vm) { if (!mpInstance.$vm) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册