<template>
<div>
<h2>{{weatherData.city}}</h2>
<h3>{{weatherData.weather}}</h3>
<rain-cloud v-if="iconSelect==='09d'"/>
<sun-cloud v-if="iconSelect==='04d'"/>
<sunshine v-if="iconSelect=='01d'"/>
<thunder-cloud v-if="iconSelect=='11d'"/>
<windy-cloud v-if="iconSelect=='50d'"/>
<snow-cloud v-if="iconSelect=='13d'"/>
<div class="container">
<h2>{{weatherData.temperature}}°C</h2>
<h4>max temperature: {{weatherData.tempMax}}°C</h4>
<h4>min temperature: {{weatherData.tempMin}}°C</h4>
<h4>humidity: {{weatherData.humidity}}%</h4>
</div>
</div>
</template>
computed:{
iconSelect(){
if(this.weatherData.icon==="04n" || "04d"){
this.weatherData.icon="04d"
}
else if(this.weatherData.icon==="01d"|| "01n"){
this.weatherData.icon="01d"
}
else if(this.weatherData.icon==="11d"|| "11n"){
this.weatherData.icon="11d"
}
else if(this.weatherData.icon==="50d"|| "50n"){
this.weatherData.icon="50d"
}
else if(this.weatherData.icon==="13d"|| "13n"){
this.weatherData.icon="13d"
}
else if(this.weatherData.icon==="09d"||"09n"||"10d"||"10n"){
this.weatherData.icon="09d"
}
return this.weatherData.icon
}
Each SVG animation component represents a different weather type, and only one should be rendered based on the conditions. Is there a way to achieve this with v-if, considering that each weather condition has a specific icon code that needs to be handled appropriately?