0

我正在尝试用我的数据从我的 firebase 实时数据库中创建一个 file.txt,但首先我需要将我的数据推送到我的方法downloadfile()并循环抛出。但我找不到解决方案!有人能帮我吗?

let app = Firebase.initializeApp(config);
let db = app.database();

let booksRef = db.ref('books');

export default {
name: 'App',
firebase: {
 books: booksRef
},
data () {
  return {
    newBook: {
     author: '',
     title: '',
     genre: ''
    }
  }
},

methods: {

downloadFile: function() {

  // Need all my data from firebase
  // and loop throw my data

  //btw: i am using npm save-as to make my file.txt and this works.

  let blob = new Blob([data], { type: 'text/plain;charset=utf-8' })
  saveAs(blob, 'file.txt')

  }
 }
}

提前致谢。

4

0 回答 0