Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Vue Computed Component Not Firing

I’ve been running the Vue extension for Chrome. As soon as I turned it off, none of my computed components work. All of my data comes from Django. One example:

import axios from 'axios'
    

export default { 
    name: 'Game',
    
    data() { 
        return { 
            game: {},
            newDate: ''
        }
    },

    computed: {
        dateNoTime() { 
                    this.newDate = this.game.date.substring(0, this.game.date.indexOf("T"));
        }

If I have the Vue extension loaded, using {{ newDate }} works just fine. Without it, however, nothing gets pulled. I’ve tried a method as well with no luck.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

this one worked when I tested it

methods: {
  dateNoTime: function () { 
    this.newDate = this.game.date.toJSON().slice(0,10).replace(/-/g,'/');
  }
},
  mounted () {
  this.dateNoTime()
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading