{"record":{"id":"7ac0b795a518dfe7","repo":"Meituan-Dianping/mpvue","slug":"the-data-property-key-is-already-declared-as-7ac0b7","errorCode":null,"errorMessage":"The data property \"${key}\" is already declared as a prop. Use prop default value instead.","messagePattern":"The data property \"(.+?)\" is already declared as a prop\\. Use prop default value instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/instance/state.js","lineNumber":145,"sourceCode":"    )\n  }\n  // proxy data on instance\n  const keys = Object.keys(data)\n  const props = vm.$options.props\n  const methods = vm.$options.methods\n  let i = keys.length\n  while (i--) {\n    const key = keys[i]\n    if (process.env.NODE_ENV !== 'production') {\n      if (methods && hasOwn(methods, key)) {\n        warn(\n          `method \"${key}\" has already been defined as a data property.`,\n          vm\n        )\n      }\n    }\n    if (props && hasOwn(props, key)) {\n      process.env.NODE_ENV !== 'production' && warn(\n        `The data property \"${key}\" is already declared as a prop. ` +\n        `Use prop default value instead.`,\n        vm\n      )\n    } else if (!isReserved(key)) {\n      proxy(vm, `_data`, key)\n    }\n  }\n  // observe data\n  observe(data, true /* asRootData */)\n}\n\nfunction getData (data: Function, vm: Component): any {\n  try {\n    return data.call(vm)\n  } catch (e) {\n    handleError(e, vm, `data()`)\n    return {}","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/src/core/instance/state.js#L127-L163","documentation":"Raised in initData when a data key also exists in the props option. Props are initialized before data and proxied on the instance first, so the data entry would collide with the prop binding; moreover props are owned by the parent and re-supplied on every parent re-render, making the local data value unreachable. Vue skips proxying the data key, and the prop's value (or its default) is what the instance actually reads.","triggerScenarios":"Thrown at src/core/instance/state.js:145 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the duplicated key from data and rely on the prop, declaring a prop default if a fallback value is needed","If the component needs a locally mutable version, keep the prop and add a differently-named data property initialized from it"],"exampleFix":null,"handlingStrategy":"validation","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"}