I have this code and the goal from it is to update a data sticky to true if the scroll position is > than 0
export default {
  components: {
  },
  data() {
    return {
      menuVisible: false,
      sticky: false,
    }
  },
  mounted() {
    this.checkScroll()
  },
  methods: {
    checkScroll() {
      document.querySelector('body').onscroll = function() {
        console.log(window.pageYOffset > 0)
        this.sticky = window.pageYOffset > 0
      }
    },
  },
}
the problem is that even that i see the true console logged, the data is allways false ( as the initial value )
Any idea why is not updating it?


 
    