import { component } from '@angular/core';
import { httpclient } from '@angular/common/http';
@component({
selector: 'app-tab2',
templateurl: 'tab2.page.html',
styleurls: ['tab2.page.scss']
})
export class tab2page {
//f37304922567ba032a7332a50765b21a
aboutdata={
url:"http://web.juhe.cn:8080/finance/stock/hkall",
ionicurl:"http://106.13.46.223:8066/home/getdata",
ionicstockurl:"http://106.13.46.223:8066/home/getstockalldata",
key:"f37304922567ba032a7332a50765b21a",
page:1,
stockdata:[
],
httpoptions:{}
}
constructor(public http:httpclient) {
this.http.get(
this.aboutdata.ionicstockurl+"?url="+
this.aboutdata.url+"?key="+this.aboutdata.key+"&page="+this.aboutdata.page)
.subscribe((respone:any)=>{
console.log(respone);
if(respone.reason=="successed!")
{
// this.aboutdata.stockdata.push(respone.result.data);
this.aboutdata.stockdata.push.apply(this.aboutdata.stockdata,respone.result.data);
//
this.aboutdata.page=parseint(respone.result.page)+1;
}
})
}
dorefresh($event) {
this.aboutdata.page=1;
this.http.get(
this.aboutdata.ionicstockurl+"?url="+
this.aboutdata.url+"?key="+this.aboutdata.key+"&page="+this.aboutdata.page)
.subscribe((respone:any)=>{
console.log(respone);
if(respone.reason=="successed!")
{
this.aboutdata.stockdata.length=0;
// this.aboutdata.stockdata.push(respone.result.data);
this.aboutdata.stockdata.push.apply(this.aboutdata.stockdata,respone.result.data);
//
this.aboutdata.page=parseint(respone.result.page)+1;
}
$event.target.complete();
})
}
doinfinite($event) {
console.log(this.aboutdata.page);
this.http.get(
this.aboutdata.ionicstockurl+"?url="+
this.aboutdata.url+"?key="+this.aboutdata.key+"&page="+this.aboutdata.page)
.subscribe((respone:any)=>{
console.log(respone);
if(respone.reason=="successed!")
{
// this.aboutdata.stockdata.push(respone.result.data);
this.aboutdata.stockdata.push.apply(this.aboutdata.stockdata,respone.result.data);
//
this.aboutdata.page=parseint(respone.result.page)+1;
console.log(this.aboutdata.page);
}
$event.target.complete();
})
}
rowclick($event)
{
console.log($event.target);
}
}
网友评论