diff --git a/src/common/http.api.js b/src/common/http.api.js index 4fff77e..eff1dc1 100644 --- a/src/common/http.api.js +++ b/src/common/http.api.js @@ -14,6 +14,9 @@ const CATEGORIES_URL = "/categories" // 商品页列表搜索 const GOODS_SEARCH_URL = '/goods/search' +// 商品详情搜索 +const GOODS_DETAIOL_URL = '/goods/detail' + // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作 const install = (Vue, vm) => { @@ -28,9 +31,11 @@ const install = (Vue, vm) => { // 商品页 // 商品列表搜索 const getGoods = (params = {}) => vm.$u.get(GOODS_SEARCH_URL, params) + // 商品详情 + const getGoodsDetail = (params = {}) => vm.$u.get(GOODS_DETAIOL_URL, params) // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 - vm.$u.api = { getSwiperdata, getCatitems, getFloordata, getCategories, getGoods } + vm.$u.api = { getSwiperdata, getCatitems, getFloordata, getCategories, getGoods, getGoodsDetail } } export default { diff --git a/src/pages.json b/src/pages.json index 35fdf24..9cb2acc 100644 --- a/src/pages.json +++ b/src/pages.json @@ -83,7 +83,7 @@ { "name": "商品详情页", "path": "pages/goods_detail/goods_detail", - "query": "id=33" + "query": "goods_id=33" }, { "name": "商品列表", diff --git a/src/pages/goods_detail/goods_detail.vue b/src/pages/goods_detail/goods_detail.vue index aa5f40a..8983cf5 100644 --- a/src/pages/goods_detail/goods_detail.vue +++ b/src/pages/goods_detail/goods_detail.vue @@ -1,13 +1,49 @@ - \ No newline at end of file + \ No newline at end of file