N
N
Nikolay Semenov2017-06-27 12:17:39
JavaScript
Nikolay Semenov, 2017-06-27 12:17:39

How to load data into a component before rendering it in Vue?

Guys, hello everyone!!
I ran into such a problem, in one of the components in the console a bunch of errors fall out, due to the fact that the variables are udefined , after they are still displayed and it could be added, but it’s not comme il faut.
Who solves this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Kulakov, 2017-06-27
@kulakoff Vue.js

Fill with default values? Update after the data is received.

props: {
    age: {
      type: Number,
      default: 0,
      required: true,
      validator: function (value) {
        return value >= 0
      }
    }
  }

A
Aslan, 2017-06-27
@iFlashka

Component Life Cycle Diagram

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question