Pārlūkot izejas kodu

feat:添加点击事件

AmandaG 1 gadu atpakaļ
vecāks
revīzija
016fda480e

+ 5 - 0
src/views/Dashboard/src/components/BarChart.vue

@@ -187,6 +187,11 @@ const initChart = () => {
   window.addEventListener('resize', () => {
     bar_chart.resize()
   })
+  // 监听点击事件
+  bar_chart.on('click', function (params) {
+    // params 包含了点击事件的数据
+    console.log('1111', params) // 获取点击的数据
+  })
 }
 </script>
 

+ 5 - 0
src/views/Dashboard/src/components/PieChart.vue

@@ -171,6 +171,11 @@ const initChart = () => {
   window.addEventListener('resize', () => {
     pie_chart.resize()
   })
+  // 监听点击事件
+  pie_chart.on('click', function (params) {
+    // params 包含了点击事件的数据
+    console.log(params.data) // 获取点击的数据
+  })
 }
 </script>
 

+ 5 - 0
src/views/Dashboard/src/components/SellerChart.vue

@@ -169,6 +169,11 @@ const initChart = () => {
   window.addEventListener('resize', () => {
     seller_chart.resize()
   })
+  // 监听点击事件
+  seller_chart.on('click', function (params) {
+    // params 包含了点击事件的数据
+    console.log(params) // 获取点击的数据
+  })
 }
 </script>
 

+ 2 - 2
src/views/Dashboard/src/components/TopMap.vue

@@ -6,9 +6,9 @@ onMounted(() => {
 })
 const map = ref(null)
 const init = () => {
-  map.value = L.map('map').setView([51.505, -0.09], 13)
+  map.value = L.map('map').setView([51.505, -0.09], 4)
 
-  L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
+  L.tileLayer('https://map.kerryapex.com/osm_tiles/{z}/{x}/{y}.png', {
     attribution: '&copy; OpenStreetMap contributors'
   }).addTo(map.value)
 }

+ 1 - 0
src/views/Tracking/src/TrackingView.vue

@@ -147,6 +147,7 @@ const TagsList = ref<ListItem[]>([])
 const filterTag = ref(['All'])
 onMounted(() => {
   setTimeout(() => {
+    console.log(TrackingTable_ref.value)
     TransportListItem.value = TrackingTable_ref.value.TransportListItem
     TagsList.value = TrackingTable_ref.value.TagsList
   }, 1000)