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

Lightningコンポーネント(JSテクニック)

Last updated at Posted at 2018-09-28

Base64データをFileに変換する

changeBase64ToFile: function(base64) {
    // decode base64
    var bin = atob(base64.replace(/^.*,/, ''));

    // convert to binary
    var buffer = new Uint8Array(bin.length);
    for (var i = 0; i < bin.length; i++) {
       buffer[i] = bin.charCodeAt(i);
    }
    // create a File object
    return new File([buffer.buffer], name, {type: "application/vnd.ms-excel"});
}

ダイアログボックスを開いた時に背景のHTMLをスクロールしないようにする

自前でモーダルダイアログを表示した際に、背景のHTMLがスクロールしないようにするには、bodyタグのoverflow属性で制御する。

ダイアログを表示する時
document.body.style.overflow = 'hidden'

ダイアログを閉じる時(これをやらないと、親画面のスクロールができないままになる)
document.body.style.overflow = 'null'

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