[
{
"_id": "578c2f687ec482840b07e4e8",
"nodes": [
"XYK0101000002G",
"XYK0101000007G"
],
"users": [
{
"_id": "578c2f2c7ec482840b07e4e7",
"name": "18951904112",
"group_id": "578c2f687ec482840b07e4e8",
"latest_get_message_time": 1477385019,
"role": "master",
"info": {
"phone": "1895112",
"name": "",
"address": "江苏",
"mou_num": 0,
"pond_num": 0,
"per_mou_fish": 0,
"kinds": [
"混养"
]
}
},
{
"_id": "57e3531f79dc5d5417b55825",
"name": "17895001036",
"group_id": "578c2f687ec482840b07e4e8",
"role": "helper",
"info": {
"phone": "1904112",
"name": "李",
"address": "江苏省园区",
"mou_num": 0,
"pond_num": 0,
"per_mou_fish": 0,
"kinds": [
"混养"
]
}
}
]
},
{
"_id": "578c2f687ec482840b07e4e8",
"nodes": [
"XYK0101000002G",
"XYK0101000007G"
],
"users": [
{
"_id": "578c2f2c7ec482840b07e4e7",
"name": "18951112",
"group_id": "578c2f687ec482840b07e4e8",
"latest_get_message_time": 1477385019,
"role": "master",
"info": {
"phone": "18951904112",
"name": "",
"address": "",
"mou_num": 0,
"pond_num": 0,
"per_mou_fish": 0,
"kinds": [
"混养"
]
}
}
]
}
];
这是数据
一个users是一个数据,我想按users的记录数作为序号,怎么实现
但是这个地方题主是不是想根据users的数量进行编号,不知道我理解的对不对。
// 此路不通,通车成本略大。
// 这样子我的建议是在最外层init一个变量,最里层的v-for每次++。
干脆直接上css吧
显示声明index:
v-for="(userInfo , userIndex) in list.users"
1.x (userIndex , userInfo) in list.users 索引在前
2.x (userInfo , userIndex) in list.users 值在前,并且$index已废弃
参考资料:Vue.js v2.0 中文教程