|
|
|
@ -2,8 +2,8 @@
@@ -2,8 +2,8 @@
|
|
|
|
|
<div> |
|
|
|
|
<city-header></city-header> |
|
|
|
|
<city-search></city-search> |
|
|
|
|
<city-list></city-list> |
|
|
|
|
<city-alphabet></city-alphabet> |
|
|
|
|
<city-list :cities="cities" :hot="hotCities"></city-list> |
|
|
|
|
<city-alphabet :cities="cities"></city-alphabet> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -12,6 +12,8 @@ import CityHeader from "./components/header";
@@ -12,6 +12,8 @@ import CityHeader from "./components/header";
|
|
|
|
|
import CitySearch from "./components/search"; |
|
|
|
|
import CityList from "./components/list"; |
|
|
|
|
import CityAlphabet from "./components/Alphabet"; |
|
|
|
|
import axios from "axios"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: "City", |
|
|
|
|
components: { |
|
|
|
@ -19,10 +21,30 @@ export default {
@@ -19,10 +21,30 @@ export default {
|
|
|
|
|
CitySearch: CitySearch, |
|
|
|
|
CityList: CityList, |
|
|
|
|
CityAlphabet: CityAlphabet |
|
|
|
|
}, |
|
|
|
|
data: function() { |
|
|
|
|
return { |
|
|
|
|
cities: {}, |
|
|
|
|
hotCities: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getCityInfo: function() { |
|
|
|
|
axios.get("/api/city.json").then(this.getCityInfoSucc); |
|
|
|
|
}, |
|
|
|
|
getCityInfoSucc: function(res) { |
|
|
|
|
res = res.data; |
|
|
|
|
if (res.ret && res.data) { |
|
|
|
|
const data = res.data; |
|
|
|
|
this.cities = data.cities; |
|
|
|
|
this.hotCities = data.hotCities; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted: function() { |
|
|
|
|
this.getCityInfo(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style lang="stylus" scoped> |
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
|
<style lang="stylus" scoped></style> |
|
|
|
|