title: How to compute styles on <body> or <html> using vue.js?
body: <p>I am using <a href="https://v2.vuejs.org/v2/guide/class-and-style.html" rel="nofollow noreferrer">vuejs style bindings</a> to render changes dynamically as the styles are computed.</p>
  <p>This works great for everything within the scope of my Vue instance but how can I compute styles for body or html tags?
  This used to be possible when you could bind the vue instance to  but vue no longer lets you do it.</p>
  <p>I want to dynamically update the background color of  using my computed variables in vue.</p>
  <p>edit: added code snippet to demonstrate</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = new Vue({
    el: '#app',
    data: {
      color: '#666666'
    },
    computed: {
      backgroundColor: function() {
        return {
          'background-color': this.color
        }
      }
    },
    methods: {
      toggleBackground: function() {
        if(this.color=='#666666'){
          this.color = '#BDBDBD'
        } else {
          this.color = '#666666'
        }
      }
    }
  })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://vuejs.org/js/vue.min.js"&gt;&lt;/script&gt;
  &lt;html&gt;
    &lt;body&gt;
      &lt;div id="app" :style="backgroundColor"&gt;
        &lt;div&gt;
          lots of content...
        &lt;/div&gt;
        &lt;button @click="toggleBackground"&gt; Click to toggle &lt;/button&gt;
      &lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>