weather.js
941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//import shop from '../../api/shop'
//气象预警
// initial state
const state = {
all: [],
weather_news:'>预计今天下午出现2-3级,偏南风1'//最新天气信息
}
// getters
const getters = {}
// actions
const actions = {
// getAllProducts ({ commit }) {
// shop.getProducts(products => {
// commit('setProducts', products)
// })
// }
act_set_weather_news ({ commit, state }, products) {
commit('set_weather_news', products)
}
}
// mutations
const mutations = {
// 设置最新天气情况
set_weather_news(state, resData){
//debugger;
state.weather_news = resData;
}
// setProducts (state, products) {
// state.all = products
// },
//
// decrementProductInventory (state, { id }) {
// const product = state.all.find(product => product.id === id)
// product.inventory--
// }
}
export default {
namespaced: true,
state,
getters,
actions,
mutations
}