【发布时间】:2018-06-14 08:33:46
【问题描述】:
在我的回复中:
{
"1": [
{
"id": 11,
"seniorcitizen_id": 67201379,
"courier_id": 33,
"totalPrice": 500,
"delivery_date": "June 14, 2018, 12:00 am",
"packed": 0,
"parcel_id": 1,
"medicine_id": 1,
"qty": 3,
"owner": {
"id": 67201379,
"barangay_id": 1,
"first_name": "Cloyd",
"middle_name": "O'Keefe",
"last_name": "Hackett",
"gender": "female",
"mobile": "639153353163",
"telephone": "877-710-3958",
"caretakers_name": "Prof. Laurence Kertzmann",
"caretakers_mobile_phone": "639153353163",
"lat": "10.30431500",
"lng": "123.89035500",
"address": "213 Marlon Forks\nSouth Corineland, HI 81723-1044",
"budget": 1000,
"status": 1,
"dob": "-0001-11-30 00:00:00",
"created_at": "2017-10-19 18:09:10",
"updated_at": "2017-10-19 18:09:10"
}
},
{
"id": 12,
"seniorcitizen_id": 67201379,
"courier_id": 33,
"totalPrice": 500,
"delivery_date": "June 14, 2018, 12:00 am",
"packed": 0,
"parcel_id": 1,
"medicine_id": 5,
"qty": 2,
"owner": {
"id": 67201379,
"barangay_id": 1,
"first_name": "Cloyd",
"middle_name": "O'Keefe",
"last_name": "Hackett",
"gender": "female",
"mobile": "639153353163",
"telephone": "877-710-3958",
"caretakers_name": "Prof. Laurence Kertzmann",
"caretakers_mobile_phone": "639153353163",
"lat": "10.30431500",
"lng": "123.89035500",
"address": "213 Marlon Forks\nSouth Corineland, HI 81723-1044",
"budget": 1000,
"status": 1,
"dob": "-0001-11-30 00:00:00",
"created_at": "2017-10-19 18:09:10",
"updated_at": "2017-10-19 18:09:10"
}
},
{
"id": 13,
"seniorcitizen_id": 67201379,
"courier_id": 33,
"totalPrice": 500,
"delivery_date": "June 14, 2018, 12:00 am",
"packed": 0,
"parcel_id": 1,
"medicine_id": 6,
"qty": 3,
"owner": {
"id": 67201379,
"barangay_id": 1,
"first_name": "Cloyd",
"middle_name": "O'Keefe",
"last_name": "Hackett",
"gender": "female",
"mobile": "639153353163",
"telephone": "877-710-3958",
"caretakers_name": "Prof. Laurence Kertzmann",
"caretakers_mobile_phone": "639153353163",
"lat": "10.30431500",
"lng": "123.89035500",
"address": "213 Marlon Forks\nSouth Corineland, HI 81723-1044",
"budget": 1000,
"status": 1,
"dob": "-0001-11-30 00:00:00",
"created_at": "2017-10-19 18:09:10",
"updated_at": "2017-10-19 18:09:10"
}
}
],
"11": [
{
"id": 18,
"seniorcitizen_id": 67201376,
"courier_id": 33,
"totalPrice": 400,
"delivery_date": "June 14, 2018, 12:00 am",
"packed": 0,
"parcel_id": 11,
"medicine_id": 4,
"qty": 2,
"owner": {
"id": 67201376,
"barangay_id": 1,
"first_name": "Jess",
"middle_name": "Kris",
"last_name": "Berge",
"gender": "female",
"mobile": "93332998610",
"telephone": "(855) 951-3687",
"caretakers_name": "Brad O'Connell",
"caretakers_mobile_phone": "9332998610",
"lat": "10.30309100",
"lng": "123.89154500",
"address": "1291 Stephania Road\nLake Dorotheastad, TN 82682-76",
"budget": 1000,
"status": 1,
"dob": "-0001-11-30 00:00:00",
"created_at": "2017-10-19 18:09:09",
"updated_at": "2017-10-19 18:09:09"
}
},
{
"id": 19,
"seniorcitizen_id": 67201376,
"courier_id": 33,
"totalPrice": 400,
"delivery_date": "June 14, 2018, 12:00 am",
"packed": 0,
"parcel_id": 11,
"medicine_id": 5,
"qty": 2,
"owner": {
"id": 67201376,
"barangay_id": 1,
"first_name": "Jess",
"middle_name": "Kris",
"last_name": "Berge",
"gender": "female",
"mobile": "93332998610",
"telephone": "(855) 951-3687",
"caretakers_name": "Brad O'Connell",
"caretakers_mobile_phone": "9332998610",
"lat": "10.30309100",
"lng": "123.89154500",
"address": "1291 Stephania Road\nLake Dorotheastad, TN 82682-76",
"budget": 1000,
"status": 1,
"dob": "-0001-11-30 00:00:00",
"created_at": "2017-10-19 18:09:09",
"updated_at": "2017-10-19 18:09:09"
}
}
],
"13": [
{
"id": 21,
"seniorcitizen_id": 67201380,
"courier_id": 33,
"totalPrice": 350,
"delivery_date": "June 14, 2018, 12:00 am",
"packed": 0,
"parcel_id": 13,
"medicine_id": 2,
"qty": 2,
"owner": {
"id": 67201380,
"barangay_id": 1,
"first_name": "Ryann",
"middle_name": "Kub",
"last_name": "Bauch",
"gender": "male",
"mobile": "9332998610",
"telephone": "1-855-475-0137",
"caretakers_name": "Mr. Jarrett Ziemann II",
"caretakers_mobile_phone": "9332998610",
"lat": "10.30356400",
"lng": "123.89964100",
"address": "20330 Schmeler Course Apt. 210\nNorth Ari, NV 70048",
"budget": 1000,
"status": 1,
"dob": "-0001-11-30 00:00:00",
"created_at": "2017-10-19 18:09:10",
"updated_at": "2017-10-19 18:09:10"
}
},
{
"id": 22,
"seniorcitizen_id": 67201380,
"courier_id": 33,
"totalPrice": 350,
"delivery_date": "June 14, 2018, 12:00 am",
"packed": 0,
"parcel_id": 13,
"medicine_id": 19,
"qty": 2,
"owner": {
"id": 67201380,
"barangay_id": 1,
"first_name": "Ryann",
"middle_name": "Kub",
"last_name": "Bauch",
"gender": "male",
"mobile": "9332998610",
"telephone": "1-855-475-0137",
"caretakers_name": "Mr. Jarrett Ziemann II",
"caretakers_mobile_phone": "9332998610",
"lat": "10.30356400",
"lng": "123.89964100",
"address": "20330 Schmeler Course Apt. 210\nNorth Ari, NV 70048",
"budget": 1000,
"status": 1,
"dob": "-0001-11-30 00:00:00",
"created_at": "2017-10-19 18:09:10",
"updated_at": "2017-10-19 18:09:10"
}
}
]
}
使用此数据: 我想使用 lodash 进行映射,如果打包为 0,则返回 false,如果为 1,则返回 true。
canToggle(){
_.map(this.parcels, function(status) {
var parcelState ;
status.packed === 0 ? parcelState = true : parcelState = false ;
return parcelState ;
});
},
并将其传递给我的组件道具,例如:
<delivery-parcel :parcel="parcel" :index="index" :packed="canToggle"></delivery-parcel>
所以在我传递的道具中:它会像:
props: ['packed','index','parcel'],
data(){
return {
isPacked : this.packed
}
并在我的复选框中使用它,以便查看包裹是否已打包,以判断该特定包裹是否已打包。
<v-checkbox @click="togglePacked" v-model="isPacked"></v-checkbox>
【问题讨论】:
标签: vue.js lodash vuetify.js