Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

feat: improve the head API #41

Closed
@chanlito

Description

@chanlito

Currently according to the README useHead() is being used outside of the component.

Usually functions starting with useXXX are composition API used inside components.
Which to me, I think it might cause confusion.

I think the API would be cleaner like the following, but not sure if the implementation is possible.
Just giving my opinion.

import { defineComponent, head, useMeta } from 'nuxt-composition-api';

export default defineComponent({
  // this line is needed!
  head,
  setup() {
    // This will allow you to set the title in head - but won't allow you to read its state outside of this component.
    const { title } = useMeta()

    title.value = 'newSetTitle'
  },
})

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions