1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
| <template>
| <view class="role-container">
| <view @click="enableRole(item)" v-for="(item, index) in roleData" :key="index" :class="item.active?'active':''">
| <view class="l">
| <u-icon :name="item.icon" width="80rpx" height="80rpx"></u-icon>
| <view class="role-name">
| {{item.roleName}}
| </view>
| </view>
|
| <!-- <view v-if="item.active" class="r">
| <u-icon name="checkmark" color="#2979ff"></u-icon>
| </view> -->
| <view v-if="item.id == currentId" class="r">
| <u-icon name="checkmark" color="#2979ff"></u-icon>
| </view>
| </view>
| </view>
| </template>
|
| <script>
| export default {
| props: {
| roleData: {
| type: Array,
| default: () => []
| },
| currentId:{
| type:[Number,String]
| }
| },
|
| data() {
| return {}
| },
|
| methods: {
|
| //启用角色
| enableRole(item) {
| this.roleData.forEach(role => {
| if (role.id == item.id) {
| role.active = true
| } else {
| role.active = false
| }
| })
|
| this.$emit("select", item)
|
| },
| },
| }
| </script>
|
| <style lang="scss" scoped>
| .role-container {
| &>view {
| display: flex;
| justify-content: flex-start;
| align-items: center;
| margin:0 30rpx;
| padding:30rpx 0;
| border-bottom:1px solid #F5F5F5;
| .l {
| flex: 1;
| display: flex;
| align-items: center;
|
| .role-name {
| margin-left: 16rpx;
| }
| }
| }
| }
|
| .active {
| background-color: #e8effb !important;
| }
| </style>
|
|