var rentPricesData = {rentPrices: []} Vue.component('room-rent-component', { template: `
{{dist.avgPrice}} 元/月
{{dist.houseType}}室
`, data: function(){ return rentPricesData; }, methods: { loadRoomRent:function(){ axios.get("/rest/trend/roomRent", { params: { city: city, region:region, name: name } }).then(function (response) { var datas = response.data.data if(datas){ var ret = [] for(var v in datas){ var o = datas[v] ret.push(o); } rentPricesData.rentPrices = ret; $("#roomDiv .cardRentWin").css("width",(6.5*ret.length)+"rem"); }else{ $("#roomDiv").hide() } }).catch(function (error) { alert(error) console.log(error); }); } }, mounted:function(){ this.loadRoomRent(); } })