Last active
October 27, 2018 02:40
-
-
Save fannyhasbi/02e772c6b113ae6f860ab15433c203c3 to your computer and use it in GitHub Desktop.
Vue instance for PWA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Vue({ | |
el:'#app', | |
data:{ | |
kodepos : [],search : '', awal:0,akhir:10,halaman:1,tampil:true | |
}, | |
created(){ | |
this.getData(); | |
console.log(this.awal) | |
}, | |
methods:{ | |
next(){ | |
this.awal=this.awal+=10 | |
this.akhir=this.akhir+=10 | |
this.halaman=this.halaman+=1 | |
}, | |
prev(){ | |
this.awal=this.awal-=10 | |
this.akhir=this.akhir-=10 | |
this.halaman=this.halaman-=1 | |
}, | |
getData(){ | |
var kd=this; | |
axios.get('https://kodepos-2d475.firebaseio.com/kota_kab/k110.json?print=pretty').then(function(response){ | |
kd.kodepos=response.data; | |
}) | |
} | |
}, | |
computed:{ | |
cari(){ | |
return this.kodepos.filter(pos =>{ | |
return pos.kecamatan.toLowerCase().match(this.search.toLowerCase()); | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment