{"record":{"id":"17b65c08aafe3ff5","repo":"Meituan-Dianping/mpvue","slug":"no-getter-function-has-been-defined-for-computed-p-17b65c","errorCode":null,"errorMessage":"No getter function has been defined for computed property \"${key}\".","messagePattern":"No getter function has been defined for computed property \"(.+?)\"\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/instance/state.js","lineNumber":178,"sourceCode":"    return data.call(vm)\n  } catch (e) {\n    handleError(e, vm, `data()`)\n    return {}\n  }\n}\n\nconst computedWatcherOptions = { lazy: true }\n\nfunction initComputed (vm: Component, computed: Object) {\n  process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'computed')\n  const watchers = vm._computedWatchers = Object.create(null)\n\n  for (const key in computed) {\n    const userDef = computed[key]\n    let getter = typeof userDef === 'function' ? userDef : userDef.get\n    if (process.env.NODE_ENV !== 'production') {\n      if (getter === undefined) {\n        warn(\n          `No getter function has been defined for computed property \"${key}\".`,\n          vm\n        )\n        getter = noop\n      }\n    }\n    // create internal watcher for the computed property.\n    watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions)\n\n    // component-defined computed properties are already defined on the\n    // component prototype. We only need to define computed properties defined\n    // at instantiation here.\n    if (!(key in vm)) {\n      defineComputed(vm, key, userDef)\n    } else if (process.env.NODE_ENV !== 'production') {\n      if (key in vm.$data) {\n        warn(`The computed property \"${key}\" is already defined in data.`, vm)\n      } else if (vm.$options.props && key in vm.$options.props) {","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/src/core/instance/state.js#L160-L196","documentation":"Emitted during initComputed for a computed entry whose definition yields no getter: the entry is neither a function (the shorthand getter form) nor an object with a .get member — e.g. computed: { foo: {} } or computed: { foo: someUndefined }. A lazy watcher is still created with an undefined getter, so evaluating the computed in a template will throw 'Cannot read properties of undefined' when the watcher's getter is invoked.","triggerScenarios":"Thrown at src/core/instance/state.js:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the function shorthand: computed: { fullName() { return this.first + ' ' + this.last } }","For writable computeds, supply both members: { foo: { get() {...}, set(v) {...} } }","Check that the computed value is not accidentally undefined (e.g. a bad import or a spread that dropped the function)"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b","analyzedAt":"2026-09-02T05:17:40.946Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}