property this.$el undefined on single file component vue js property this.$el undefined on single file component vue js vue.js vue.js

property this.$el undefined on single file component vue js


$el doesn't exist until mounted.

mounted() {  var vm = this;  var options = {      "locale": "es",              "onChange": function(selectedDates, dateStr, instance) {          vm.$emit('input', dateStr);      }    };  $(this.$el)    // init    .flatpickr(options);      },

See the lifecycle diagram in the documentation.