邓洁: 优化界面
This commit is contained in:
@@ -1,45 +1,38 @@
|
||||
<template>
|
||||
<div id="item-info">
|
||||
<div id="item-info" v-if="params.wp!==undefined">
|
||||
<div class="label">
|
||||
<div :style="{ backgroundImage: 'url(' +getImageUrl(windIcon)+')' }" class="wind-icon"></div>
|
||||
<span>{{ params.name }}</span>
|
||||
<span>{{ params.wp.name }}</span>
|
||||
</div>
|
||||
<div class="container" ref="length">
|
||||
<div class="value" ref="value"></div>
|
||||
<div id="point" ref="point"></div>
|
||||
</div>
|
||||
<div class="value-num" :class="{ warning: isWaring }">
|
||||
{{ valueAndUnit }}
|
||||
{{ params.wp.value }} {{ params.wp.unit }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const params = defineProps({
|
||||
wp: Object,
|
||||
icon: String,
|
||||
name: String,
|
||||
unit: String,
|
||||
wp: Object
|
||||
});
|
||||
// const info = {
|
||||
// windPId: 0, //编号
|
||||
// max: 120, //最大值
|
||||
// value: 40, //测量值
|
||||
// point: 60, //阈值
|
||||
// };
|
||||
const windIcon = reactive(params.icon);
|
||||
|
||||
const windIcon = ref();
|
||||
const length = ref(null);
|
||||
const value = ref(null);
|
||||
const point = ref(null);
|
||||
onMounted(handleOnMounted);
|
||||
|
||||
function handleOnMounted() {
|
||||
setValue();
|
||||
}
|
||||
|
||||
watch(() => params.wp.value, () => {
|
||||
setValue();
|
||||
});
|
||||
const isWaring = ref();
|
||||
// watch(() => params.wp.value, () => {
|
||||
// setValue();
|
||||
// });
|
||||
onMounted(() => {
|
||||
if (params.wp !== undefined) {
|
||||
setValue();
|
||||
windIcon.value = params.wp.icon
|
||||
}
|
||||
})
|
||||
const getImageUrl = (name) => {
|
||||
return new URL(`../../../../assets/images/airInfo/${name}`, import.meta.url).href
|
||||
}
|
||||
@@ -55,23 +48,25 @@ const setValue = () => {
|
||||
value.value.style.background =
|
||||
"linear-gradient(270deg, #38CAFB 0%, #E9D726 100%)";
|
||||
}
|
||||
isWaring.value = params.wp.value >= params.wp.point;
|
||||
}
|
||||
let isWaring = computed(() => {
|
||||
return params.wp.value >= params.wp.point;
|
||||
});
|
||||
// let isWaring = computed(() => {
|
||||
// return params.wp.value >= params.wp.point;
|
||||
// });
|
||||
|
||||
const valueAndUnit = computed(() => params.wp.value + " "+ params.unit );
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#item-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
width: 790px;
|
||||
padding: 5px 14px;
|
||||
margin-bottom: 30px;
|
||||
margin-bottom: 25px;
|
||||
margin-left: 21px;
|
||||
|
||||
&:hover {
|
||||
width: 790px;
|
||||
background: #2E5589;
|
||||
border-radius: 6px;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user