Skip to content

Can't access component methods when binding :key on a template #2085

Closed
@amrnn90

Description

@amrnn90

Version

3.0.0-rc.10

Reproduction link

https://codesandbox.io/s/happy-fast-vfld6?file=/src/App.vue

Steps to reproduce

Open reproduction link, the code binds :key on a template using a method:

  <template v-for="item in items" :key="itemKey(item)">
    {{item.name}}
  </template>

What is expected?

Should render items normally without throwing an error

What is actually happening?

An error is thrown:

Uncaught ReferenceError: itemKey is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions