Skip to content

Nuxt Example data binding not working #1792

Description

@jaketig

Docs suggest data binding inside of defineConfig
This doesn't appear to work.

<script setup>
defineConfig({
  user: 'world',
})
</script>

<template>
  <Layout>
    <Container class="max-w-xl">
      <Heading>
        Hello, {{ user }}!
      </Heading>
      <Text>
        Welcome aboard!
      </Text>
      <Button href="https://example.com">
        Verify email
      </Button>
    </Container>
  </Layout>
</template>
Image

Should this bedefineProps isntead of defineConfig?

<script setup>
defineProps({
  user: {
    type: String,
    default: 'world',
  },
})

defineConfig({
  
})
</script>

<template>
  <Layout>
    <Container class="max-w-xl">
      <Heading>
        Hello, {{ user }}!
      </Heading>
      <Text>
        Welcome aboard!
      </Text>
      <Button href="https://example.com">
        Verify email
      </Button>
    </Container>
  </Layout>
</template>
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions