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 32 | 1x 1x 1x 1x 1x 1x 1x 56x 26x 26x 32x 32x 32x 32x 32x 32x 32x 20x | import shallowEqual from 'shallowequal' import { isDev } from '../util/env' import { warn } from '../util/warn' export function initComputed (vm, forceUpdate: boolean = false) { if (vm._isMounted || forceUpdate) { const computed = vm.$options.computed || {} Object.keys(computed).forEach(key => { const userDef = computed[key] const getter = typeof userDef === 'function' ? userDef : userDef.get if (isDev && !getter) { warn( `Getter is missing for computed property "${key}".`, vm ) }I if (getter) { const value = getter.call(vm, vm) if (Evm.$options.props && key in vm.$options.props) { if (isDev) { warnI(`The computed property "${key}" is already defined as a prop.`, vm) } } else if (!shallowEqual(vm._renderProxy.data[key], value)) { vm._renderProxy.setData({ [key]: value, }) } } }) } } |