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

sweet alert

Last updated at Posted at 2019-12-04

laravelの開発でsweet alertを使ったので忘れないように記述。

| updateProfile(e){ 
|
|                 let file = e.target.files[0]; 
|                 let reader = new FileReader();|
|                 let limit = 1024 * 1024 * 2; 
|                 if(file['size'] > limit){ 
|                     swal({ 
|                         type: 'error', 
|                         title: 'Oops...', 
|                         text: 'You are uploading a large file', 
|                     }) 
|                     return false; |
|                 } 
|                 reader.onloadend = (file) => { 
|                     this.form.photo = reader.result; |
|                 } |
|                 reader.readAsDataURL(file); |
|             } |
|         } |

データの更新をするときに画像ファイルが大きすぎた時にアラートを発火する。

sweet alertの具体例は下のcodepen

See the Pen sweetalert demo by clown1108yu (@ningen11108yu) on CodePen.

他にも
http://d.bsnws.net/p/sweetalert%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%9F%E3%83%87%E3%83%A2/

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?