title: Nuxt.js run code on page load
body: <p>How do I run code when a <a href="https://nuxtjs.org/guide/views#pages" rel="nofollow noreferrer">page</a> loads with Nuxt.js?</p>
  
  <p>I'd like to add a class if the browser supports touch events using <code>!!window.ontouchstart</code>.</p>
  
  <p>I tried this, but <code>window</code> is undefined:</p>
  
  <pre><code>```
  &lt;section v-bind:class="{ touch: !!window.ontouchstart }"&gt;
     ...
  &lt;/section&gt;
  ```
  </code></pre>