北京经济技术开发区经开区虚拟城市项目-【前端】-移动端Web
少年
2024-03-04 4a5af28ba9fc254b81aae7345ae936cbaf0716be
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<template>
  <div class="historyBox">
    <div class="colseBtn">
      <img class="searchBtn" @click="close" src="@/assets/closeinput1.png" />
    </div>
    <div class="listBox">
      <ul>
        <li
          v-for="(item, index) in arr"
          :key="index"
          @click="changeLeftMap(item)"
          :class="{ active: currentValue == item }"
        >
          {{ item }}
        </li>
      </ul>
    </div>
  </div>
</template>
 
<script>
import store from "@/utils/store2";
import { addHistoryLayer } from "@/utils/tool";
export default {
  name: "historyBox",
  components: {},
  data() {
    return {
      arr: [
        2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
        2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
      ],
      currentValue: 2021,
    };
  },
  mounted() {
    window.mapapi.getView().setCenter([4.606512, 2.621472]);
    addHistoryLayer(this.currentValue);
  },
  methods: {
    changeLeftMap(item) {
      this.currentValue = item;
      addHistoryLayer(this.currentValue);
    },
    close() {
      store.setHistoryShow(false);
    },
  },
};
</script>
<style scoped>
.colseBtn {
  position: absolute;
  top: 5vh;
  right: 20px;
}
 
.searchBtn {
  width: 40px;
  height: 40px;
}
 
.listBox {
  position: absolute;
  right: 20px;
  bottom: 10px;
  background-color: #373737;
}
 
.listBox li {
  padding: 2px;
  border: 1px solid #000;
  color: white;
}
 
.listBox li:hover {
  background-color: #00e1ff;
}
 
.mapLeft {
  float: left;
  position: absolute;
  width: 100vw;
  height: 100vh;
}
 
.active {
  background-color: #4590d7;
}
</style>