Last active
May 23, 2018 17:56
-
-
Save hugoalmeidahh/754a276f234faa32519ff61a5fb0b950 to your computer and use it in GitHub Desktop.
my mock makers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var app = new Vue({ | |
el: '#app', | |
data(){ | |
return { | |
markers: [], | |
MID: 0, | |
currentInfoWindow: null, | |
options : {timeout: 10000, enableHighAccuracy: true}, | |
} | |
}, | |
methods: { | |
methods: { | |
getMarkers: mockasync(getAPI), | |
getAPI:function(){ | |
return[ | |
{ | |
... | |
}, | |
{... | |
}, | |
] | |
}, | |
mockasync:function(){ | |
function mocked(){ | |
var res = f.apply(this, arguments); | |
return new Promise(function(resolve, reject){ | |
window.setTimeout(function(){ | |
resolve({data: res}); | |
}, 500); | |
}); | |
} | |
return mocked; | |
}, | |
reverseMessage: function () { | |
this.message = this.message.split('').reverse().join('') | |
} | |
}, | |
mounted(){ | |
function loadMarkers(lat, lng, km){ | |
this.getMakers(lat, lng, km).then(function(result){ /* << == Esse está lá no methods ...*/ | |
var records = result; | |
for (var i = 0; i < records.length; i++) { | |
var record = records[i]; | |
} | |
} | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment