Dynamically binding title tag in vuejs

Viewed 3840

I'm new to vuejs.

I try to bind data on the title tag dynamically. I used vue-head to do this on a simple html page. I do not use webpack and npm.

This is how I bind the title tag :

var app = new Vue({
            el: 'html',
            head: {
              title: function () {
                return {
                    inner: this.remaining + ' Tâches',
                    separator: ' ',
                    complement: ' '   
                }
              }
            }

In the vue-head documentation, they suggest to do this :

methods: {
  getAsyncData: function () {
    var self = this
    window.setTimeout(function () {
    self.title = 'My async title'
    self.$emit('updateHead')
    }, 3000)
  }
},

I also tried to set it in the watch prop, but it didn't work.

Here is my entire code : https://jsfiddle.net/5d70s0s6/1/

Thanks

1 Answers
Related