title: Watch window.scrollY and router :id in Vue2JS
body: <p>So basically I was able to watch <code>window.scrollY</code> by adding normal eventListner of resize in created hook and remove it in destroyed hook. On resize I was checking <code>window.scrollY</code> and if it was upper or lower than 500  I was changing boolean variable on which I bind different classes:</p>
  
  <pre><code>&lt;nav class="navbar u-no-padding"
       v-if="displayedNav"
       :class="minimizedNav ? 'navbar__not-collapsed' : 'navbar__collapsed'"&gt;
  </code></pre>
  
  <p>Also if in url I have <code>:id</code> (which is part of vue router) then I'm totaly hiding nav so I also use <code>v-if</code> directive.</p>
  
  <p>It was working fine but then I realize that I can use vue <code>watch</code> to watch <code>window.srollY</code> in order to change some boolean variable in data() when <code>window.srollY</code> is upper or lower than 500</p>
  
  <p>I can also watch <code>this.$route.params.id</code> and if it's set then change <code>this.displayed</code> to false.</p>
  
  <p>So in the end I will have two watchers which will change booleans and on this booleans I'm doing something with nav as shown in html. I tried to create that and end up with</p>
  
  <pre><code>export default {
      data() {
          return {
              minimizedNav: true,
              displayedNav: true,
              buildingId: this.$route.params.id
          }
      },
      watch: {
          'buildingId' : (data) =&gt; {
              console.log(data);
              if(data) this.displayedNav = false;
          },
          'window.scrollY' : (data) =&gt; {
              console.log(data);
              if(data &gt; 500) this.minimizedNav = false;
              if(data &lt;= 500) this.minimizedNav = true;
          }
      }
  }
  </code></pre>
  
  <p>But it doesn't work, I was suspecting that it will <code>console.log(data)</code> where data is <code>this.$route.params.id</code> or <code>buildingId</code> on every its change. But it doesn't console anything. Why, what I'm doing wrong here?</p>