Manage Document Title

Update the document’s title with reactive data.
new Vue({
  el: '#app',
  data: () => ({
    documentTitle: document.title
  watch: {
    documentTitle: {
      immediate: true,
      handler (value) {
        document.title = value

Since the root Vue instance is almost always initialized on a child element of <body>, we don’t have access to elements in <head>. The solution is actually very simple: to watch a data attribute that corresponds to the document title, and then use DOM functions for updating.

This is only a proof of concept. If you want full power over a document’s meta with SSR support, take a look at vue-meta.