Skip to content

experimental "ref sugar": local variables sharing a name with a top-level ref are overwritten #3445

Closed
@zhangenming

Description

@zhangenming

Version

3.0.7

Reproduction link

https://codesandbox.io/s/eloquent-antonelli-xr3fb?file=/src/App.vue

Steps to reproduce

<template>
  <button @click="test">...</button>
</template>

<script setup>
ref: x = 1
function test() {
  const x = { value: 2 }
  console.log(x) //will  show 1, should show 2
}
</script>

What is expected?

show 2

What is actually happening?

show 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions