vue2.0-taopiaopiao icon indicating copy to clipboard operation
vue2.0-taopiaopiao copied to clipboard

求解vuex里的city里的updateCityAsync函数

Open LJJ1994 opened this issue 6 years ago • 3 comments

你好。我有个疑惑,就是下面这段代码里的 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 }) }) } } `

LJJ1994 avatar Nov 01 '18 15:11 LJJ1994

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

canfoo avatar Dec 02 '18 14:12 canfoo

你好,我是覃国雷;你的邮件我已经收到,祝你天天开心,幸福美满。

thunderqin avatar Nov 22 '23 08:11 thunderqin