Sternisic
Sternisic

Reputation: 319

How to save data from Firebase as a number with Vue.js

I use Firebase with Vue.js. Here I save to the database with this command:

saveEvent(){
  db.collection('events').add({
    title: this.title,
    content: this.content,
    start: this.start,
    end: this.end,
    split: this.split,
  })
  this.events.push(this.data)
}

Everything is saved as string, but I would like to save 'split' as a number.

Split is saved as a String

do you have any suggestions for solutions?

Upvotes: 0

Views: 177

Answers (1)

captainskippah
captainskippah

Reputation: 1549

try doing split: Number(this.split) to cast a string into number.

Upvotes: 1

Related Questions