0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

@clickのあとに@blurを発火させたい

Last updated at Posted at 2024-01-19

前提

Vue.js 3

検索機能付きのセレクトボックスを作成中

pulldown_image.png

やりたいこと

選択肢モーダルの外側をクリックしたときに、モーダルが閉じるようにしたい。
@blurでフォーカスが外れた時にモーダルを閉じる。

困っていること

モーダルに@clickを設定して選択肢をセレクトしているが、
clickイベントより先にblurイベントが発火するため、選択肢を押下できない。

解決

そもそも@clickではなく@mousedownをつかう。

参考
https://stackoverflow.com/questions/61137481/blur-event-cancels-click-event-in-vue-component

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?