Skip to content

Without using setup syntax sugar, using templates and jsx playgrounds at the same time will result in an error(不使用setup语法糖情况下,同时使用模板和jsx演练场会报错) #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zzcr opened this issue Jan 2, 2025 · 0 comments

Comments

@zzcr
Copy link

zzcr commented Jan 2, 2025

报错信息:Identifier '_createVNode' has already been declared. (15:80)

复现demo:

<script lang="jsx">
import { ref } from 'vue'
export default {
  setup(){
    const msg=ref()
    const aa = () => <div>xxx</div>
    return {msg,aa}
  }
}
</script>

<template>
  <h1>{{ msg }}</h1>
  <component :is="aa"></component>
  <input v-model="msg" />
</template>

复现链接:https://repl-vuejs.vercel.app/#eNp9UstqwzAQ/JVFlySQxpT2ZGxDW3JoD21pe9RF2GtHqSwLPVyD8b93LZM0hxIwZjUzK81oNbIHY3Z9QJayzJVWGg9K6Cbn7OgGzgquZWs662EEizVMUNuuhRV1rLjGIVIV1iIoknAN4NAHs97EGqDstPPQuian7vXmEhQCclhvIC8gq2RfDMOQJXOxiCztYzWM1LsVYppB+tGXJYtP0tHCY2uU8Bi7ssNtMY7zcTBNWUKriJYdRdCoPaTSUTIhKFiWnOFFJbUJHvqbtqtQkYp24QwSIrPk4hS2Zd5Rglo2u6PrNF1czMrZvJ9UaN+Ml5SQs3S5kZkTSnU/LxHzNuD2hJcHLL//wePlp1S8W3Roe+TszHlhG/QLvf98xYHqM0nugyL1FfIDXafC7HGRPQZdke0LXXT7HOcudfPl9oNH7U6hZqNxHFHPGb2FpyvR/+ze7e5PY2TTLxIY0Sg=

如果使用setup语法糖则没有此问题:

<script setup lang="jsx">
import { ref } from 'vue'
const aa = () => <div>xxx</div>
const msg = ref('Hello World!')
</script>

<template>
  <h1>{{ msg }}</h1>
  <component :is="aa"></component>
  <input v-model="msg" />
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant