{"record":{"id":"b458d95f5bdbc348","repo":"Meituan-Dianping/mpvue","slug":"key-does-not-work-on-slot-because-slots-are-ab-b458d9","errorCode":null,"errorMessage":"`key` does not work on <slot> because slots are abstract outlets and can possibly expand into multiple elements. Use the key on a wrapping element instead.","messagePattern":"`key` does not work on <slot> because slots are abstract outlets and can possibly expand into multiple elements\\. Use the key on a wrapping element instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/compiler/parser/index.js","lineNumber":424,"sourceCode":"function addIfCondition (el, condition) {\n  if (!el.ifConditions) {\n    el.ifConditions = []\n  }\n  el.ifConditions.push(condition)\n}\n\nfunction processOnce (el) {\n  const once = getAndRemoveAttr(el, 'v-once')\n  if (once != null) {\n    el.once = true\n  }\n}\n\nfunction processSlot (el) {\n  if (el.tag === 'slot') {\n    el.slotName = getBindingAttr(el, 'name')\n    if (process.env.NODE_ENV !== 'production' && el.key) {\n      warn(\n        `\\`key\\` does not work on <slot> because slots are abstract outlets ` +\n        `and can possibly expand into multiple elements. ` +\n        `Use the key on a wrapping element instead.`\n      )\n    }\n  } else {\n    const slotTarget = getBindingAttr(el, 'slot')\n    if (slotTarget) {\n      el.slotTarget = slotTarget === '\"\"' ? '\"default\"' : slotTarget\n    }\n    if (el.tag === 'template') {\n      el.slotScope = getAndRemoveAttr(el, 'scope')\n    }\n  }\n}\n\nfunction processComponent (el) {\n  let binding","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/src/compiler/parser/index.js#L406-L442","documentation":"Dev-only warning in processSlot: a key was set on a <slot> element. Slots are abstract outlets that may expand into multiple nodes, so a single key is meaningless for the diff algorithm; the key attribute is ignored and the warning directs you to a real wrapper element.","triggerScenarios":"Thrown at src/compiler/parser/index.js:424 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the :key from <slot>","Wrap the slot in a keyed real element if you need to key the region"],"exampleFix":null,"handlingStrategy":"fallback","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"}