Kaynağa Gözat

make_model: support date filename suffix when exporting

master
Bing Sun 5 yıl önce
ebeveyn
işleme
3a245825c7
İmzalayan: sunb GPG Anahtar Kimliği: F7795F8C590626AB
1 değiştirilmiş dosya ile 19 ekleme ve 11 silme
  1. +19
    -11
      src/util/make_model.js

+ 19
- 11
src/util/make_model.js Dosyayı Görüntüle

@@ -211,7 +211,6 @@ export default (options={}) => {
},

export(options={}) {
options.filename = options.filename || _configs.endpoint
let _data = this.data()

if (options.type == 'csv') {
@@ -226,16 +225,25 @@ export default (options={}) => {
let blob = new Blob([_data], {type: options.type})
let url = URL.createObjectURL(blob)

if (options.timestamp)
options.filename = options.filename + (new Date()).toLocaleTimeString(undefined, {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: false
})
options.filename = options.filename || _configs.endpoint
if (options.filename_suffix) {
if (options.filename_suffix == 'datetime')
options.filename = options.filename + (new Date()).toLocaleTimeString(undefined, {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: false
})
else if (options.filename_suffix == 'date')
options.filename = options.filename + (new Date()).toLocaleDateString(undefined, {
year: "numeric",
month: "2-digit",
day: "2-digit"
})
}

let anchor = document.createElement('a')
anchor.href = url


Yükleniyor…
İptal
Kaydet