vueuse/head

Options API Dynamic Title

Closed this issue ยท 3 comments

I am using Vue 3 with the options API and while static titles work fine, I cannot seem to get dynamic ones to work:

<script lang="ts">
export default {
  data() {
    return {
      foo: "hello world",
    };
  },
  head() {
    return {
      title: this.foo,
    };
  },
};
</script>

<template>
  <div>
    <h1>Hello World</h1>
  </div>
</template>

I also tried using this.$data.foo in head() with no success.

Thanks for reporting. Should be fixed in 1.0.19

Hi @harlan-zw , I tried same code in Vue 2.7.14 and version 1.1.26 of @vueuse/head, but it doesn't seem to work. Is it limited to Vue 3+ ?

Will track here #187