Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求解vuex里的city里的updateCityAsync函数 #14

Open
LJJ1994 opened this issue Nov 1, 2018 · 3 comments
Open

求解vuex里的city里的updateCityAsync函数 #14

LJJ1994 opened this issue Nov 1, 2018 · 3 comments

Comments

@LJJ1994
Copy link

LJJ1994 commented Nov 1, 2018

你好。我有个疑惑,就是下面这段代码里的 Vue.http.get(/movie/hot/?city=${city.rN}),它请求的是前缀等于城市的首字母缩写的_hot.json文件吗??那这里的rN是自己在局部state里自定义的吧??
`import { UPDATECITY } from './type'
import { mapMutations } from 'vuex'

import Vue from 'vue'
export default {
updateCityAsync ({ commit, state }, {city}) {
if (!city.name) {
city.name = state.name
city.rN = state.rN
}
return Vue.http.get(/movie/hot/?city=${city.rN}).then((response) => {
let data = response.data
let lists = data.data.data.returnValue
//模拟索引数据的id号
lists.forEach((item, index) => {
item.mID = index
})
city.data = lists
commit(UPDATECITY, { city })
})
}
}
`

@canfoo
Copy link
Owner

canfoo commented Dec 2, 2018

不算自定义的,是从城市列表那边传过来的

@thunderqin
Copy link

thunderqin commented Nov 22, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@thunderqin @canfoo @LJJ1994 and others