Skip to content

Commit

Permalink
添加(ui): 天气图标
Browse files Browse the repository at this point in the history
  • Loading branch information
secext2022 committed Feb 5, 2024
1 parent b38487d commit 993058a
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
17 changes: 13 additions & 4 deletions ui-vue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ui-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@mdi/font": "^7.4.47",
"qweather-icons": "^1.6.0",
"roboto-fontface": "*",
"vue": "^3.4.14",
"vue-router": "^4.2.5",
Expand All @@ -19,7 +20,7 @@
"@vitejs/plugin-vue": "^5.0.3",
"sass": "^1.69.7",
"unplugin-fonts": "^1.1.1",
"vite": "^5.0.11",
"vite": "^5.0.12",
"vite-plugin-vuetify": "^2.0.1"
}
}
17 changes: 17 additions & 0 deletions ui-vue/src/c/天气/qw天气图标.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script setup>
const p = defineProps({
图标: String,
});
</script>

<template>
<div class="c-qw天气图标 text-primary">
<i :class="`qi-${p.图标}`" />
</div>
</template>

<style scoped>
.c-qw天气图标 {
font-size: 1.2em;
}
</style>
21 changes: 20 additions & 1 deletion ui-vue/src/c/天气/qw小时预报.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup>
import { computed } from "vue";
import { 格式化时分 } from "@/util/时间.js";
import cqw天气图标 from "./qw天气图标.vue";
const p = defineProps({
天气数据: Object,
Expand All @@ -11,6 +12,7 @@ const 显示数据 = computed(() => {
时间: 格式化时分(new Date(x.fxTime)),
温度: x.temp,
t: Number.parseFloat(x.temp),
图标: x.icon,
}));
// 温度范围
let 最小 = 0;
Expand Down Expand Up @@ -47,7 +49,10 @@ const 显示数据 = computed(() => {
<v-row class="内容" no-gutters>
<template v-for="(i, j) in 显示数据">
<v-col class="" col="1">
<span>{{ i.温度 }}&deg;C</span>
<div class="顶部">
<span>{{ i.温度 }}&deg;C</span>
<cqw天气图标 :图标="i.图标" />
</div>

<div class="温度条0">
<div class="温度条1">
Expand Down Expand Up @@ -87,6 +92,20 @@ const 显示数据 = computed(() => {
align-items: center;
}
.顶部 {
position: relative;
top: 0;
left: 0;
}
.c-qw天气图标 {
position: absolute;
left: 0;
bottom: 140%;
width: 100%;
text-align: center;
}
.温度条0 {
position: relative;
top: 0;
Expand Down
1 change: 1 addition & 0 deletions ui-vue/src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "./assets/body.css";
import "qweather-icons/font/qweather-icons.css";

import { createApp } from "vue";
import App from "./App.vue";
Expand Down

0 comments on commit 993058a

Please sign in to comment.