File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
laravel/app/Http/Controllers/Api Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 17
17
{{ scope.row.id }}
18
18
</template >
19
19
</el-table-column >
20
- <el-table-column label =" 用户名称" >
20
+
21
+ <el-table-column label =" 用户昵称" >
21
22
<template slot-scope="scope">
22
23
{{ scope.row.name }}
23
24
</template >
24
25
</el-table-column >
25
26
27
+ <el-table-column label =" 邮箱" >
28
+ <template slot-scope="scope">
29
+ {{ scope.row.email }}
30
+ </template >
31
+ </el-table-column >
32
+
33
+ <el-table-column label =" 分配的角色" >
34
+ <template slot-scope="scope">
35
+ <el-tag v-for =" role in scope.row.roles" :key =" role.id" >{{ role.name }}</el-tag >
36
+ </template >
37
+ </el-table-column >
38
+
26
39
<el-table-column align =" center" prop =" created_at" label =" 创建时间" width =" " >
27
40
<template slot-scope="scope">
28
41
<i class =" el-icon-time" />
@@ -178,4 +191,7 @@ export default {
178
191
.pagination {
179
192
margin : 20px auto ;
180
193
}
194
+ .el-tag {
195
+ margin : 0 5px ;
196
+ }
181
197
</style >
Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ public function __construct()
37
37
public function index ()
38
38
{
39
39
$ list = User::paginate (11 );
40
+ foreach ($ list as $ key => $ item ) {
41
+ $ list [$ key ]['roles ' ] = $ item ->roles ;
42
+ }
40
43
return $ this ->out (200 , $ list );
41
44
}
42
45
You can’t perform that action at this time.
0 commit comments