Skip to content

better <script setup> with new API #5798

Closed
@gumingWu

Description

@gumingWu

What problem does this feature solve?

In Jan, I create an issue to discuss that add the name attribute in <script setup>, made a hot discussion, many friends like this idea and hold that vue can support it

NOW! I have a new idea, in the <script setup>, I can write my JSX by new API - defineTemplate

E.g.

<script lang="ts">
export default defineComponent({
    name: 'Comp',
    setup() {
        const msg = ref('hi')
          return () => (
              <div>{{ msg }}</div>
          )
      }
})
</script>

<script setup name="Comp">
const msg = ref('hi')
defineTemplate(() => (
    <div>{{ msg }}</div>
))
</script>

What does the proposed API look like?

new attribute - <script setup name>
new API - defineTemplate

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