Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1x 1x 1x 1x 20x 20x 20x 20x 20x 80x 1x 62x 62x 62x 62x 62x 62x 62x | import { ComponentOptions } from '../types/options' import { bind } from '../util/bind' import { noop } from '../util/noop' import { Doraemon } from './init' export function initLifecycle (vm, options: ComponentOptions<Doraemon>) { const methods = options.methods vm._isMounted = false vm._isDestroyed = false vm._hasHookEvent = true for (const key in methods) { vm[key] = methods[key] == null ? noop : bind(methods[key], vm) } } export function callHook (vm, hook: string) { var handlers = [vm.$options[hook]] ifE (handlers) { for (var i = 0, j = handlers.length; i < j; i++) { try { handlers[i].call(vm) } catch (e) { /** Ignore */ } } } if (vm._hasHookEvent) { Evm.$emit('hook:' + hook) } } |