import weather from 'https://cdn.skypack.dev/openweather-apis'; import vueWeatherWidget from 'https://cdn.skypack.dev/vue-weather-widget'; weather.setLang('en'); //weather.setCityId(4367872); weather.setCity('Zürich, CH'); weather.setUnits('metric'); weather.setAPPID('e242774170c5404aac3dcfe4d3686fd0'); // get the Temperature weather.getTemperature(function(err, temp){ console.log(temp); }); // get the Atm Pressure weather.getPressure(function(err, pres){ console.log(pres); }); // get the Humidity weather.getHumidity(function(err, hum){ console.log(hum); }); // get the Description of the weather condition weather.getDescription(function(err, desc){ console.log(desc); }); // get all the JSON file returned from server (rich of info) weather.getAllWeather(function(err, JSONObj){ console.log(JSONObj); }); // Adds support for the onecall api endpoint. weather.getWeatherOneCall = function(err, data){ }; // get 3 days forecast weather.getWeatherForecastForDays(3, function(err, obj){ console.log(obj); }); // get a simple JSON Object with temperature, humidity, pressure and description weather.getSmartJSON(function(err, smart){ console.log(smart); }); Vue(() => { default { components: { vueWeatherWidget, }, }; }); return (
new Vue({ el: "#app", components: { weather: VueWeatherWidget, }, }); );