bt-xtgxq-population-bigdata/src/components/card/PersonPercent.vue

52 lines
1.0 KiB
Vue
Raw Normal View History

2023-11-19 17:34:02 +08:00
<template>
<div class="container">
2023-11-20 18:04:58 +08:00
<img class="icon" :src="iconSrc">
2023-11-19 17:34:02 +08:00
<div class="value">{{ props.value }}%</div>
</div>
</template>
<script setup>
import { ref, defineProps } from 'vue';
const props = defineProps({
value: {
type: Number,
default: 0
},
type: {
type: String,
default: 'man'
}
});
const color = ref('#00bab4');
2023-11-20 18:04:58 +08:00
const iconSrc = ref('assets/imgs/icon/man.png');
2023-11-19 17:34:02 +08:00
if(props.type != 'man') {
color.value = '#ff5329';
2023-11-20 18:04:58 +08:00
iconSrc.value = 'assets/imgs/icon/woman.png';
2023-11-19 17:34:02 +08:00
}
</script>
<style lang="stylus" scoped>
.container
width 150px
height 100px
padding 20px 10px
position relative
&:after
content ' '
width 40px
height 2px
background-color v-bind(color)
position absolute
top 22px
left 48px
.icon
width 40px
.value
font-size 20px
font-weight bold
color v-bind(color)
position absolute
top 6px
left 92px
</style>