longyvfengyun
2023-12-25 d8d792a6842832e8f6af6604274c438b25053afe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<template>
    <div class="list-box">
        <div class="list-box-title">
            <div class="title-item title-item-address">{{ address }}</div>
            <div class="title-item title-item-week">今天({{ week }})</div>
            <div class="title-item title-item-date">{{ date }}</div>
        </div>
        <div class="list-box-body">
            <weather-list-item
                v-for="(item, key) in list" :key="'index'+key"
                :value="key"
                :date="item.date" :temperature="item.temperature" :weather="item.weather"></weather-list-item>
        </div>
    </div>
</template>
 
<script>
import WeatherListItem from "./weatherListItem";
import getWeek from "@/assets/js/tools/getWeek";
export default {
    name: "listBox",
    props: {
        address: {
            type: String,
            default: ""
        },
        list: {
            type: Array,
            default() {
                return []
            }
        },
    },
    components: {
        WeatherListItem
    },
    data() {
        return {
            date: "",
            week: "",
        }
    },
    methods: {
        setWeek() {
            let date = new Date().format("yyyy-MM-dd");
            this.date = date;
            this.week = getWeek(date);
        }
    },
    mounted() {
        this.setWeek();
    }
}
</script>
 
<style scoped>
.list-box {
    border: 1px solid #cccccc;
    min-width: 360px;
}
.list-box-title {
    line-height: 28px;
    border-bottom: 1px solid #cccccc;
    padding-left: 8px;
}
.title-item {
    display: inline-block;
}
.title-item-week {
    margin-left: 16px;
    font-weight: bold;
}
.title-item-date {
    margin-left: 16px;
}
</style>