You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
643 B
17 lines
643 B
import { computed } from 'vue'
|
|
import { useStore } from '@/store/root'
|
|
|
|
export const useWeather = () => {
|
|
const status = [
|
|
{ icon: 'icon-qingtian', status: '晴' },
|
|
{ icon: 'icon-duoyun', status: '云' },
|
|
{ icon: 'icon-xiaoyu', status: '雨' },
|
|
{ icon: 'icon-xiaoxue', status: '雪' },
|
|
{ icon: 'icon-duoyunzhuanyin', status: '阴' }
|
|
]
|
|
const store = useStore()
|
|
const weather = computed(() => ({ temperature_Now: store.indexList.temperature, status: store.indexList.status }))
|
|
const icon = computed(() => status.find(item => weather.value?.status?.includes(item.status)) ?? status[0])
|
|
|
|
return { weather, icon }
|
|
}
|
|
|