Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
74 views
in Technique[技术] by (71.8m points)

javascript - How Get ids from array response vue js

hello let's say i have a response data using axios vue js from laravel :

my example :


getApps(page = 1){


 
     axios.get('/api/getappforms')
     .then(response =>
     { 

   apps = response.data
  
 }
     ).catch(err => console.log(err));



}

and my laravel method :


$DataApps = Appclications::select('application.*','wilayas.name as wilaya','dairas.name as daira_field','communes.name as commune_field')
->leftJoin('dairas','dairas.id','=','application.id_daira')
->leftJoin('wilayas','wilayas.id','=','application.id_wilaya')

->leftJoin('communes','communes.id','=','application.id_commune')
->paginate(15);


    return   response()->json($DataApps);

every thing works fine just i want to fetch or get just ids in vue js from apps var and stored in another array

please help

question from:https://stackoverflow.com/questions/65935722/how-get-ids-from-array-response-vue-js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

My response data :

{"current_page":1,
"data":[{"id_app":1,"name":"soheib","last_name":"madi","phone":"23923923",
"position":"reghaia","situation":"dsdd",
"date_born":"2021-01-04","photo_profile":null,
"nb_children":2,"id_wilaya":5,"id_daira":542,"id_commune":149,
"email":"me@ma.com","job_field":"Tu00e9lu00e9surveillance",
"militaire":null,"anem":"yes","field_motivation":"je ve ce travail","created_at":"2021-01-24T23:46:05.000000Z",
"updated_at":"2021-01-24T23:46:05.000000Z","wilaya":"Batna","daira_field":"Barika",
"commune_field":"M Doukal"},
{"id_app":2,"name":"soheib",
"last_name":"madi","phone":"23923923",
"position":"reghaia","situation":"dsdd","date_born":"2021-01-04","photo_profile":null,"nb_children":2,"id_wilaya":5,
"id_daira":542,"id_commune":149,"email":"me@ma.com",
"job_field":"Tu00e9lu00e9surveillance",
"militaire":null,"anem":"yes","field_motivation":"je ve ce travail","created_at":"2021-01-24T23:47:28.000000Z",
"updated_at":"2021-01-24T23:47:28.000000Z","wilaya":"Batna",
"daira_field":"Barika","commune_field":"M Doukal"},{"id_app":3,"name":"soheib","last_name":"madi",
"phone":"23923923","position":"reghaia",
"situation":"dsdd","date_born":"2021-01-04","photo_profile":null,"nb_children":2,"id_wilaya":5,
"id_daira":542,"id_commune":149,"email":"me@ma.com",
"job_field":"Tu00e9lu00e9surveillance",
"militaire":null,"anem":"yes",
"field_motivation":"je ve ce travail","created_at":"2021-01-24T23:49:58.000000Z","updated_at":"2021-01-24T23:49:58.000000Z","wilaya":"Batna","daira_field":"Barika","commune_field":"M Doukal"}],
"first_page_url":"http://localhost:3000/api/getappforms?page=1","from":1,
"last_page":1,
"last_page_url":"http://localhost:3000/api/getappforms?page=1","links":[{"url":null,"label":"« Previous","active":false},{"url":"http://localhost:3000/api/getappforms?page=1",
"label":1,"active":true},
{"url":null,"label":"Next »","active":false}],"next_page_url":null,
"path":"http://localhost:3000/api/getappforms",
"per_page":15,"prev_page_url":null,"to":6,"total":6}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...