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
| <template>
| <el-container>
| <el-main>
| <basic-container>
| <div class="tag-group">
| <span class="tag-group__title">分类</span>
| <el-tag
| v-for="item in types"
| :key="item"
| :type="checkedTypes.includes(item)?'success':'info'" size="small"
| effect="plain" @click="changeType(item)">
| {{ item }}
| </el-tag>
| </div>
| <div>
| </div>
| </basic-container>
| </el-main>
| </el-container>
| </template>
|
| <script>
| export default {
| name: "index",
| data() {
| return {
| types: ['标签一' , '标签二' , '标签三' , '标签四','标签五' ],
| checkedTypes:[]
| }
| },
| methods:{
| changeType(type){
| if(this.checkedTypes.includes(type)){
| this.checkedTypes=this.checkedTypes.filter(item=> item!=type)
| }else {
| this.checkedTypes.push(type)
| }
| }
| }
| }
| </script>
|
| <style scoped>
| .tag-group{font-size: 14px;}
| .el-tag{
| margin: 0 0 10px 10px;
| cursor: pointer;
| }
| </style>
|
|