unyeol
unyeol

Reputation: 57

The vue component does not rerender

I received a value from the server but it does not appear in the output. I tried component keys or force updates, but to no avail.

export default {
  data() {
      return{
          msg: null,
          componentkey: 0,
      }
  },
      async mounted() {
      try{
          let response =await axios.get('http://localhost:5000/process')
          this.msg = response.data
          this.componentkey += 1;
      }
      catch (err) {
          // eslint-disable-next-line
          console.log(err)
      }
    },
};

Oh, and I'm referencing the server without being updated, can you tell me about this?

Upvotes: 0

Views: 90

Answers (1)

daiyanze
daiyanze

Reputation: 103

I think you don't need to bind the "key" attribute to the div tag. The "key" attribute is like an identity data for Vue to mark up the DOM which is created through the "v-for" loop.

Upvotes: 1

Related Questions