Skip to content

better <script setup> with new API #5798

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
gumingWu opened this issue Apr 25, 2022 · 2 comments
Closed

better <script setup> with new API #5798

gumingWu opened this issue Apr 25, 2022 · 2 comments

Comments

@gumingWu
Copy link

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

@facexl
Copy link

facexl commented Apr 25, 2022

Maybe you can write a vite plugin like this vite-plugin-vue3-define-reactive do whatever you want to do

@LinusBorg
Copy link
Member

Such proposals belong into an RFC -> www.github.com/vuejs/rfcs

@github-actions github-actions bot locked and limited conversation to collaborators Sep 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants