Vetur: 'event' is deprecated vetur6385

Created on 14 Feb 2021  路  2Comments  路  Source: vuejs/vetur

As the title says.
How do I deal with this warning? I am uncertain if this is vue side or vetur side.
How does one deal with the event otherwise?


<template>
  <p @mousewheel.passive="check()">test</p>
  {{ count }}
  <p @mousewheel.passive="test()">test</p>
</template>

<script>
import { ref } from "vue";
export default {
  setup() {
    const count = ref(0);

    const check = () => {
      const direction = event.deltaY < 0 ? count.value++ : count.value--;
      console.log(direction);
    };

    const test = () => {
      console.log(event);
    };
    return {
      check,
      count,
      test,
    };
  },
};
</script>


Screenshot_20210214_193153

question

All 2 comments

This is not related to Vetur. Typescript is warning you that you should not use it. But it likely still works in all browsers.

https://developer.mozilla.org/en-US/docs/Web/API/Window/event

Same as @LinusBorg
Maybe you need to use native event?

<p @mousewheel.passive="check"></p>
const check = (event: Event) => {
  console.log(event)
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

octref picture octref  路  3Comments

gabrielboliveira picture gabrielboliveira  路  3Comments

octref picture octref  路  3Comments

yoyoys picture yoyoys  路  3Comments

LukeLin picture LukeLin  路  3Comments