Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
海康威视
web-project
Commits
020e3908
Commit
020e3908
authored
Jan 09, 2025
by
方建宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
顶部天气组件-静态数据
parent
89f10206
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
homeModule.js
src/dataJson/home/homeModule.js
+11
-0
home.vue
src/views/home.vue
+13
-6
No files found.
src/dataJson/home/homeModule.js
0 → 100644
View file @
020e3908
export
const
homeWeatherReal
=
{
"data"
:
{
"weatherId"
:
"5c9ee7dc-db53-4041-ab91-a12bd89fc4bd"
,
"temperature"
:
-
0.6
,
"wind"
:
1.8
,
"illumination"
:
32.0
,
"windDirection"
:
""
,
"humidity"
:
0.0
,
"gatherTime"
:
"2025-01-09 15:15:47"
}
}
src/views/home.vue
View file @
020e3908
...
@@ -404,6 +404,7 @@ import {
...
@@ -404,6 +404,7 @@ import {
import
{
useRoute
,
useRouter
,
onBeforeRouteUpdate
}
from
"vue-router"
;
import
{
useRoute
,
useRouter
,
onBeforeRouteUpdate
}
from
"vue-router"
;
import
store
from
"../store/index"
;
import
store
from
"../store/index"
;
import
http
from
"../api/http"
;
import
http
from
"../api/http"
;
import
{
homeWeatherReal
}
from
"../dataJson/home/homeModule.js"
//引入cookie
//引入cookie
import
jsCookie
from
"js-cookie"
;
import
jsCookie
from
"js-cookie"
;
import
{
import
{
...
@@ -558,13 +559,19 @@ export default defineComponent({
...
@@ -558,13 +559,19 @@ export default defineComponent({
// 在组件即将挂载之前加载数据
// 在组件即将挂载之前加载数据
await
getData
();
await
getData
();
});
});
//天气组件实时更新
// const getWeather = async () => {
// var result = await http.post(
// "/api/weather/Real/",
// showWeatherData.supplyData.supplyId
// );
// var temp = result.data;
// var tempWeatherData = toRefs(showWeatherData);
// tempWeatherData.weatherData.value = temp;
// };
// 静态天气
const
getWeather
=
async
()
=>
{
const
getWeather
=
async
()
=>
{
var
result
=
await
http
.
post
(
var
temp
=
homeWeatherReal
.
data
;
"/api/weather/Real/"
,
showWeatherData
.
supplyData
.
supplyId
);
var
temp
=
result
.
data
;
var
tempWeatherData
=
toRefs
(
showWeatherData
);
var
tempWeatherData
=
toRefs
(
showWeatherData
);
tempWeatherData
.
weatherData
.
value
=
temp
;
tempWeatherData
.
weatherData
.
value
=
temp
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment