-
Notifications
You must be signed in to change notification settings - Fork 180
/
GroupContent.vue
58 lines (56 loc) · 1.28 KB
/
GroupContent.vue
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
<template>
<div class="apis-doc" v-if="group">
<div class="title">
{{group.name}}接口文档
<div class="control">
<el-button class="follow"
icon="star-on"
v-if="followed"
type="primary"
@click="unfollowGroup(group._id)">取消订阅</el-button>
<el-button class="follow"
icon="star-off"
v-else
@click="followGroup(group._id)">订阅</el-button>
</div>
</div>
<api-doc :api="api" v-for="api in apis" :key="api._id"></api-doc>
</div>
</template>
<script>
import ApiDoc from './apiDoc/Index'
import { mapActions } from 'vuex'
export default {
components: {
ApiDoc
},
props: ['apis'],
computed: {
group () {
return this.$store.state.groups.find(g => g._id === this.$route.params.groupId)
},
user () {
return this.$store.state.user
},
followed () {
return !!this.group.follower.find(f => f === this.user._id)
}
},
methods: {
...mapActions([
'followGroup',
'unfollowGroup'
])
}
}
</script>
<style lang="less">
.apis-doc > .title {
padding: 30px;
font-size: 28px;
border-bottom: 1px solid #ddd;
.control {
float: right;
}
}
</style>