Guest User

Untitled

a guest
Jun 22nd, 2018
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. new Vue({
  2. el: '#app',
  3.  
  4. data: {
  5. organizationData: []
  6. },
  7.  
  8. created: function () {
  9. this.fetchData();
  10.  
  11. },
  12. mounted: function(){
  13. this.saveOrgData();
  14. },
  15. methods: {
  16.  
  17. fetchData: function () {
  18. let vm=this;
  19. axios.get('http://localhost/contactmanage/public/api/PersonData')
  20. .then(function (response) {
  21. vm.organizationData=response.data ;
  22.  
  23. })
  24. },
  25.  
  26. saveData: function (key,data) {
  27.  
  28. localStorage.setItem(key, JSON.stringify(data));
  29.  
  30.  
  31. },
  32.  
  33. saveOrgData: function () {
  34.  
  35. for(org in this.organizationData){
  36.  
  37. this.saveData(org.catName,org.catData);
  38. }
  39.  
  40.  
  41. }
  42. }
  43.  
  44. })
  45.  
  46. [{
  47. "catName": "Android Development",
  48. "catData": [
  49. {
  50. "pid": 5,
  51. "personName": "Honey2",
  52. "email": "honey@gmail.com",
  53. "phone": "01766603578",
  54. "designationName": "Housewife",
  55. "did": 3
  56. }
  57. ]
  58. } ]
Add Comment
Please, Sign In to add comment