Subscribe on changes!

<script setup> How should the name be set

avatar
Jul 8th 2021

Version

3.1.4

Reproduction link

[https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8aDE e3sgbXNnIH19PC9oMT5cbjwvdGVtcGxhdGU XG5cbjxzY3JpcHQgc2V0dXA XG5jb25zdCBtc2cgPSAnSGVsbG8gV29ybGQhJ1xuLy8gIG5hbWUgPz9cbjwvc2NyaXB0PiJ9](https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8aDE e3sgbXNnIH19PC9oMT5cbjwvdGVtcGxhdGU XG5cbjxzY3JpcHQgc2V0dXA XG5jb25zdCBtc2cgPSAnSGVsbG8gV29ybGQhJ1xuLy8gIG5hbWUgPz9cbjwvc2NyaXB0PiJ9)

Steps to reproduce

<script lang="ts" setup>
// name??
</script>

What is expected?

can set name

What is actually happening?

Cannot set name


import { useName } from 'vue'

avatar
Jul 8th 2021

you can use a second <script> block to define options

<script lang=“ts”>
import { defineComponent } from ‘vue’

export default defineComponent({ name: ‘MyComponent’ })
</script>

<script setup lang=“ts”>
// …
</script>
avatar
Jul 8th 2021

Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow.