|
|
|
@ -1,10 +1,10 @@
@@ -1,10 +1,10 @@
|
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<home-header></home-header> |
|
|
|
|
<home-swiper></home-swiper> |
|
|
|
|
<home-icons></home-icons> |
|
|
|
|
<home-recommend></home-recommend> |
|
|
|
|
<home-weekend></home-weekend> |
|
|
|
|
<home-header :city="city"></home-header> |
|
|
|
|
<home-swiper :list="swiperList"></home-swiper> |
|
|
|
|
<home-icons :list="iconList"></home-icons> |
|
|
|
|
<home-recommend :list="recommendList"></home-recommend> |
|
|
|
|
<home-weekend :list="weekendList"></home-weekend> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -14,7 +14,8 @@ import HomeHeader from "./components/Header";
@@ -14,7 +14,8 @@ import HomeHeader from "./components/Header";
|
|
|
|
|
import HomeSwiper from "./components/Swiper"; |
|
|
|
|
import HomeIcons from "./components/Icons"; |
|
|
|
|
import HomeRecommend from "./components/Recommend"; |
|
|
|
|
import HomeWeekend from "./components/Weekend" |
|
|
|
|
import HomeWeekend from "./components/Weekend"; |
|
|
|
|
import axios from "axios"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
//单页组件名 |
|
|
|
@ -26,6 +27,35 @@ export default {
@@ -26,6 +27,35 @@ export default {
|
|
|
|
|
HomeIcons: HomeIcons, |
|
|
|
|
HomeRecommend: HomeRecommend, |
|
|
|
|
HomeWeekend: HomeWeekend |
|
|
|
|
}, |
|
|
|
|
data: function() { |
|
|
|
|
return { |
|
|
|
|
city: "城市", |
|
|
|
|
swiperList: [], |
|
|
|
|
iconList: [], |
|
|
|
|
recommendList: [], |
|
|
|
|
weekendList: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getHomeInfo: function() { |
|
|
|
|
axios.get("/api/index.json").then(this.getHomeInfoSucc); |
|
|
|
|
}, |
|
|
|
|
getHomeInfoSucc: function(res) { |
|
|
|
|
res = res.data; |
|
|
|
|
if (res.ret && res.data) { |
|
|
|
|
const data = res.data; |
|
|
|
|
this.city = data.city; |
|
|
|
|
this.swiperList = data.swiperList; |
|
|
|
|
this.iconList = data.iconList; |
|
|
|
|
this.recommendList = data.recommendList; |
|
|
|
|
// 发现一个彩蛋:如果这里没有在data指定weekendList,实际上也是可以直接操纵传值数据的 |
|
|
|
|
this.weekendList = data.weekendList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted: function() { |
|
|
|
|
this.getHomeInfo(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|