docs icon indicating copy to clipboard operation
docs copied to clipboard

Conflict with a variable with the same name in setup script

Open abitwhy opened this issue 3 years ago • 3 comments

All in the following example:

<script setup>
const v = 'Variables declared in setup script'
</script>

<template>
  <p>{{ v }} can be accessed in the template</p>
</template>

<script>
const v = 'Homonymous variable' // will cause syntax errors to be detected at variables declared by setup script
// import v from '/somewhere' // The same goes for import modules
export default {
  created() {
    console.log(v) // However, the homonymous variable can still be accessed, the thermal development environment is normal
  },
}
</script>

abitwhy avatar Mar 07 '22 01:03 abitwhy

This looks like an IDE or linting problem, not a documentation problem. Could you confirm which tool is reporting the error?

skirtles-code avatar Mar 24 '22 00:03 skirtles-code

Is eslint.

Sorry for my late reply.

abitwhy avatar May 11 '22 01:05 abitwhy

This looks like an IDE or linting problem, not a documentation problem. Could you confirm which tool is reporting the error?

Report the issue in this repo maybe because I was reading this doc, and I clicked the report link below the page.

abitwhy avatar May 11 '22 02:05 abitwhy

I'm going to close this.

As far as I'm aware there isn't a documentation problem here.

skirtles-code avatar Jan 05 '23 09:01 skirtles-code