stenciljs/eslint-plugin

How to resolve "Use vDOM listener instead"

Open

#10 建立於 2020年4月6日

在 GitHub 查看
 (13 留言) (2 反應) (0 負責人)TypeScript (37 fork)auto 404
Help Wantedtriage

倉庫指標

Star
 (71 star)
PR 合併指標
 (PR 指標待抓取)

描述

Noobie question — I’m using an example straight from the Stencil docs…

@Listen('keydown')
handleKeyDown(ev: KeyboardEvent){
  if (ev.key === 'ArrowDown'){
    console.log('down arrow pressed')
  }
}

I get an error Use vDOM listener instead, and I don’t exactly know how to resolve that… 😬 In other words, I don't exactly know how to "use a vDOM listener instead".

Also, according to the rule docs, this rule is meant to "Ensures that no vdom events are used in @Listen decorator." Why is it bad to listen to vDOM events using the @Listen decorator?

貢獻者指南