UNPKG

376 BJavaScriptView Raw
1// @flow
2import type {
3 VUE_INSTANCE,
4 COMPONENT_OBJECT_OPTION
5 } from './type'
6
7// 将methods指向vue父组件实例
8export default function (vueInstance: VUE_INSTANCE, methods: Object): Object | void {
9 if (!methods) return
10 const newMethod = {}
11 Object.keys(methods).forEach(key => Reflect.set(newMethod, key, vueInstance[methods[key]]))
12 return newMethod
13}
\No newline at end of file