Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
memberTag-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
memberTag
memberTag-web
Commits
49a2ddb9
Commit
49a2ddb9
authored
Apr 11, 2019
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加判断标签是否存在的代码
parent
e1da0a2e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
tags-group-list.vue
src/view/memberGroup/tags-group-list.vue
+17
-9
No files found.
src/view/memberGroup/tags-group-list.vue
View file @
49a2ddb9
<
template
>
<div
class=
"m-l-60"
>
<tags-group
v-for=
"(item, index) in selectedTagData"
v-for=
"(item, index) in selectedTag
s
Data"
:key=
"index"
:tagsData=
"item"
:showTagsRelation=
"(index === 0 && selectedTag
Data.length > 1) || (index === 1 && selectedTag
Data.length > 2)"
:showTagsRelation=
"(index === 0 && selectedTag
sData.length > 1) || (index === 1 && selectedTags
Data.length > 2)"
:tagsGroupIndex=
"index"
tagsRelation=
"or"
:showAddMenu=
"true"
...
...
@@ -16,7 +16,7 @@
@
changeTagsGroupRelation=
"changeTagsGroupRelation"
@
checkTagsGroup=
"checkTagsGroup"
/>
<el-button
class=
"m-t-10 w-548 el-icon-plus color-blue"
v-show=
"selectedTagData.length
<
3
"
@
click=
"addTagsGroup"
>
<el-button
class=
"m-t-10 w-548 el-icon-plus color-blue"
v-show=
"selectedTag
s
Data.length
<
3
"
@
click=
"addTagsGroup"
>
添加
</el-button>
<!-- 添加标签 -->
...
...
@@ -70,7 +70,7 @@ import { getMemberTagCount } from '@/request/memberGroup.js';
export
default
{
name
:
'tags-detail'
,
props
:
{
selectedTagData
:
Array
selectedTag
s
Data
:
Array
},
components
:
{
tagsGroup
,
...
...
@@ -96,27 +96,29 @@ export default {
methods
:
{
// 添加一个标签组,最多只能有3个标签组
addTagsGroup
()
{
this
.
selectedTag
Data
.
length
<
3
&&
this
.
selectedTag
Data
.
push
([]);
this
.
activeTagsGroup
=
this
.
selectedTagData
.
length
-
1
;
this
.
selectedTag
sData
.
length
<
3
&&
this
.
selectedTags
Data
.
push
([]);
this
.
activeTagsGroup
=
this
.
selectedTag
s
Data
.
length
-
1
;
},
// 删除一个标签组
delTagsGroup
(
data
)
{
this
.
selectedTagData
.
splice
(
data
.
tagsGroupIndex
,
1
);
this
.
selectedTag
s
Data
.
splice
(
data
.
tagsGroupIndex
,
1
);
this
.
activeTagsGroup
=
0
;
},
// 添加标签
addTags
(
data
)
{
// 添加之前先判断已选中的标签中是否存在即将添加的标签
this
.
activeTagsGroup
=
data
.
tagsGroupIndex
;
this
.
showAddTagPop
=
true
;
},
// 删除标签
delTags
(
data
)
{
this
.
selectedTagData
[
data
.
tagsGroupIndex
].
splice
(
data
.
tagIndex
,
1
);
this
.
selectedTag
s
Data
[
data
.
tagsGroupIndex
].
splice
(
data
.
tagIndex
,
1
);
this
.
activeTagsGroup
=
data
.
tagsGroupIndex
;
},
// 编辑一个标签
editTags
(
data
)
{
this
.
selectedTagData
[
data
.
tagsGroupIndex
].
splice
(
data
.
tagIndex
,
1
,
data
.
tagData
);
// 保存之前先判断已选中的标签中是否存在即将添加的标签
this
.
selectedTagsData
[
data
.
tagsGroupIndex
].
splice
(
data
.
tagIndex
,
1
,
data
.
tagData
);
this
.
activeTagsGroup
=
data
.
tagsGroupIndex
;
},
// 修改两个标签组之间的关系
...
...
@@ -200,6 +202,12 @@ export default {
handleCurrentChange
(
val
)
{
this
.
pageNum
=
val
;
this
.
getTagsGroupList
();
},
// 判断已选中的标签中是否存在将要添加的标签
isSelected
(
tagData
)
{
return
this
.
selectedTagsData
.
some
(
tagsGroup
=>
{
return
tagsGroup
.
some
(
el
=>
el
.
tagId
===
tagData
.
tagId
);
});
}
},
mounted
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment