bt-xtgxq-population-bigdata/src/module/ModuleLeft1.vue

37 lines
958 B
Vue
Raw Normal View History

2023-11-20 17:56:43 +08:00
<template>
<div class="module">
<ModuleCard1 title="民族分布统计">
2023-11-22 18:59:08 +08:00
<BarSpike id="barSpike" w="440" h="300" :x-data="barChart.xData" :data="barChart.data" title="" :key="keyCount"/>
2023-11-20 17:56:43 +08:00
</ModuleCard1>
</div>
</template>
<script setup>
2023-11-22 18:59:08 +08:00
import { ref, reactive, inject } from 'vue';
2023-11-20 17:56:43 +08:00
import ModuleCard1 from './card/ModuleCard1.vue';
import BarSpike from '../components/echarts/BarSpike.vue';
2023-11-22 18:59:08 +08:00
const axios = inject('axios');
2023-11-20 17:56:43 +08:00
2023-11-22 18:59:08 +08:00
const keyCount = ref(0);
2023-11-20 17:56:43 +08:00
const barChart = reactive({
2023-11-22 18:59:08 +08:00
xData: [],
data: []
});
axios.get(`app/query/sqlrelease/q419513e`, {}).then(res => {
let data = res.data;
data.forEach((item, index) => {
barChart.xData.push(item.name);
barChart.data.push(item.value);
})
keyCount.value++;
}).catch(err => {
console.error(err);
});
2023-11-20 17:56:43 +08:00
</script>
<style lang="stylus" scoped>
2023-11-22 18:59:08 +08:00
// .module
// .bar-spike
// background-image url(/assets/imgs/card/bg9.png)
2023-11-20 17:56:43 +08:00
</style>