https://github.com/wangjianliqq/Lianjiawang
<v-pagination?:total="total"?:currentPage='current'?v-on:pageChange="pageChange"?class="sellBottom-fenye"></v-pagination>
<script>
import?axios?from?'axios'
import?pagination?from?'./Pagination.vue'
import?imgUrl1?from?'../house1.png'
import?imgUrl2?from?'../house2.png'
export?default?{
??name:?'ErshoufangDetail',
??data?()?{
????return?{
??????total:?150,
??????pagingVolume:?10,
??????current:?1,
??????contentList:?[
????????{imgUrl:?imgUrl1,?title:?'珠江路地鐵?君臨國際?精裝修?采光好視野好',?xiaoqu:?'君臨國際',?peizhi:?'|?1室1廳?|?52.7平米?|?北?|?其他?|?有電梯',?louceng:?'高樓層(共32層)2005年建板塔結合??-??',?daolu:?'華僑路',?guanzhu:?'191人關注?/?共16次帶看?/?一年前發布',?subway:?'近地鐵',?vr:?'VR房源',?five:?'房本滿兩年',?haskey:?'隨時看房',?totalPrice:?'160',?unitPrice:?'單價31099元/平米',?active1:?false,?active2:?true,?active3:?true,?active4:?false},
????????{imgUrl:?imgUrl2,?title:?'新城市廣場摩爾特區?1室1廳?156萬',?xiaoqu:?'新城市廣場',?peizhi:?'|?1室1廳?|?51.45平米?|?北?|?精裝?|?有電梯',?louceng:?'中樓層(共12層)2005年建塔樓結合?-??',?daolu:?'龍江',?guanzhu:?'2人關注?/?共0次帶看?/?1個月以前發布',?subway:?'近地鐵',?vr:?'VR房源',?five:?'房本滿兩年',?haskey:?'隨時看房',?totalPrice:?'156',?unitPrice:?'單價29602元/平米',?active1:?true,?active2:?true,?active3:?false,?active4:?false}
??????]
????}
??},
??methods:?{
????pageChange:?function?(currentPage)?{
??????console.log(currentPage)
????},
????getPageInfo?()?{
??????///?地址為后臺數據地址為后臺數據地址為后臺數據地址為后臺數據地址為后臺數據
??????axios.get('http://47.110.132.127:9000/city/get')
????????.then(function?(res)?{
??????????res?=?res.data
??????????if?(res.ret?&&?res.data)?{
????????????const?data?=?res.data
????????????this.total?=?data.total
????????????this.pagingVolume?=?data.pagingVolume
????????????this.current?=?data.current
????????????this.contentList?=?data.contentList?///?前后名字一樣
??????????}
????????})?///?先接受json文件,然后返回函數
????????.catch(function?(error)?{
??????????console.log(error)
????????})
????}
??},
??mounted?()?{
????this.getPageInfo()?///?先寫個鉤子函數
??},
??components:?{
????'v-pagination':?pagination
??}
}
</script>
VUE仿鏈家網,分頁時怎么從后臺服務器獲取數據,并展示在頁面上。
慕田峪2258837
2019-05-22 20:13:55
