[Vuejs]-Get the component data from the external JS function

0👍

You can pass the component instance to your function as an argument

// component
created() {
    ...
    addMarker(this, doc.id, doc.data())
    ...
}

// external function
function addMarker(vm, id, data) {
    ...
    vm.markers.push(m)
    ...
}

Leave a comment