1
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 3 years have passed since last update.

Vueでフォームを表示せずに画像の更新を行う方法

Last updated at Posted at 2020-12-12

結論

こんな感じ。色と配置は適当なので参考にしないでください。
Image from Gyazo

See the Pen image submit with vue by msickpaler (@msickpaler) on CodePen.

clearImage() {
  this.image = "https://i.gyazo.com/459b578735367db587a1193f9afe84da.png"
  document.getElementById('input_image').value = '' //忘れやすい
}

inputの値を初期化しないと、
画像選択→クリア→同じ画像選択
したときに2回目の画像選択でinputの値が変わらず@changeで発火しないのでちゃんと初期化しましょう。

1
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
1
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?