methods: {
getSelectedValue() {
var values = this.options.map(function(o) { return o.value })
var index = values.indexOf(this.selected)
var selectedText = this.options[index].text
//alert(selectedText)
getWwather(selectedText)
}
//codul din mounted l-am pus in functia de mai jos
function getWwather(selected){
var api_url = "http://api.apixu.com/v1/current.json?key=cheie_api&q=" + selected
axios.get(api_url).then(response => {
app.object.location = response.data.location.name;
app.object.time = response.data.location.localtime;
app.object.actual_temp = response.data.current.temp_c;
app.object.feels_like = response.data.current.feelslike_c;
})
}
Am actualizat si codepen-ul
Folosesc Apixu pt a prelua datele depsre vreme, in caz ca este cineva interesat.