Skip to content

Data attributes not added #363

@toniengelhardt

Description

@toniengelhardt

🐛 The bug

I'm trying to figure out how to add data-* attributes to scripts with useScript() in app.vue.

The following should be working according to the docs, but it doesn't. The script is loaded, but the data-test attribute is missing.

// My code
useScript({
  'src': 'https://analytics.ahrefs.com/analytics.js',
  'data-test': 'some-value-here',
})

From the docs here:

Image

There is also mention of an attributes key in UseScriptInput, which doesn't seem to exist:

Image

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-scripts-attributes-not-working?file=app.vue

🌈 Expected behavior

data-* properties should show up in the source and attributes should either work, or be removed from the docs.

ℹ️ Additional context

nuxt/scripts@v0.9.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions