This path is absolutely wrong.
First of all, keep the data model as clean as possible, so there are no methods.
Secondly, as the error says, when you are dealing with data in a component, the data should be functions that return an object:
Vue.component('careers', { template: '<div>A custom component!</div>', data: function() { return { careerData: [] } } });
As I write, data sampling and other logic should not be in the model, so for VueJS there is an object reserved for VueJS called methods
So, move your logic to a method, and when you have the data, you can assign it to a career by assigning it like this:
this.careerData = newData
or drag objects into an array, as you did before. And then at the end you can call the method on some lifecycle hooks:
Vue.component('careers', { template: '<div>A custom component!</div>', data: function() { return { careerData: [] } }, created: function() { this.fetchData(); }, methods: { fetchData: function() {
source share