Vue展示商品列表数据,改了local_host之后,不显示列表数据,浏览器页面报错
来源:6-3 vue展示商品分类数据
慕圣3437809
2017-11-08
import axios from 'axios'; let base = ''; let host = 'http://shop.projectsedu.com'; let local_host = 'http://127.0.0.1:8000'; //获取商品类别信息 export const queryCategorygoods = params => { return axios.get(`${host}/indexgoods/`) } //获取首页中的新品 export const newGoods = params => { return axios.get(`${host}/newgoods/`) } //获取轮播图 export const bannerGoods = params => { return axios.get(`${host}/banners/`) } //获取商品类别信息 export const getCategory = params => { if('id' in params){ return axios.get(`${local_host}/categorys/`+params.id+'/'); } else { return axios.get(`${local_host}/categorys/`, params); } };
在浏览器页面F12报错
vue.common.js:573 [Vue warn]: Error in render: "TypeError: Cannot read property 'id' of null" found in ---> <Head> at C:\Users\WXJ\Desktop\online-store\src\views\head\head.vue <App> at C:\Users\WXJ\Desktop\online-store\src\views\app\app.vue <App> at C:\Users\WXJ\Desktop\online-store\src\App.vue <Root> warn @ vue.common.js:573 logError @ vue.common.js:1691 globalHandleError @ vue.common.js:1686 handleError @ vue.common.js:1675 Vue._render @ vue.common.js:4415 updateComponent @ vue.common.js:2703 get @ vue.common.js:3046 run @ vue.common.js:3123 flushSchedulerQueue @ vue.common.js:2889 (anonymous) @ vue.common.js:1791 flushCallbacks @ vue.common.js:1712 vue.common.js:1695 TypeError: Cannot read property 'id' of null at head.vue?7fea:167 at Proxy.renderList (vue.common.js:3648) at Proxy.render (head.vue?7fea:150) at VueComponent.Vue._render (vue.common.js:4413) at VueComponent.updateComponent (vue.common.js:2703) at Watcher.get (vue.common.js:3046) at Watcher.run (vue.common.js:3123) at flushSchedulerQueue (vue.common.js:2889) at Array.<anonymous> (vue.common.js:1791) at MessagePort.flushCallbacks (vue.common.js:1712)
这是什么问题啊,郁闷死了
写回答
1回答
-
bobby
2017-11-10
是不是你加了分页了 课程中有些view没有分页功能 如果加了分页功能会改变返回的json的格式 你检查一下
222017-12-27
Python前后端分离开发Vue+Django REST framework实战
Django REST framework课程视频,RESTFul API前后端分离开发
2873 学习 · 2457 问题
相似问题