Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cocktail-party-server
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cocktail-party
cocktail-party-server
Commits
72e4cd9f
提交
72e4cd9f
authored
11月 29, 2023
作者:
RuoYi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化字典标签支持自定义分隔符
上级
1525bd8b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
26 行删除
+23
-26
index.vue
ruoyi-ui/src/components/DictTag/index.vue
+23
-26
没有找到文件。
ruoyi-ui/src/components/DictTag/index.vue
浏览文件 @
72e4cd9f
...
...
@@ -7,7 +7,7 @@
:key=
"item.value"
:index=
"index"
:class=
"item.raw.cssClass"
>
{{
item
.
label
+
" "
}}
</span
>
{{
item
.
label
+
' '
}}
</span
>
<el-tag
v-else
...
...
@@ -17,7 +17,7 @@
:type=
"item.raw.listClass == 'primary' ? '' : item.raw.listClass"
:class=
"item.raw.cssClass"
>
{{
item
.
label
+
" "
}}
{{
item
.
label
+
' '
}}
</el-tag>
</
template
>
</template>
...
...
@@ -40,6 +40,10 @@ export default {
showValue
:
{
type
:
Boolean
,
default
:
true
,
},
separator
:
{
type
:
String
,
default
:
","
}
},
data
()
{
...
...
@@ -49,39 +53,32 @@ export default {
},
computed
:
{
values
()
{
if
(
this
.
value
!==
null
&&
typeof
this
.
value
!==
"undefined"
)
{
return
Array
.
isArray
(
this
.
value
)
?
this
.
value
:
[
String
(
this
.
value
)];
}
else
{
return
[];
}
if
(
this
.
value
===
null
||
typeof
this
.
value
===
'undefined'
||
this
.
value
===
''
)
return
[]
return
Array
.
isArray
(
this
.
value
)
?
this
.
value
.
map
(
item
=>
''
+
item
)
:
String
(
this
.
value
).
split
(
this
.
separator
)
},
unmatch
()
{
this
.
unmatchArray
=
[];
if
(
this
.
value
!==
null
&&
typeof
this
.
value
!==
"undefined"
)
{
// 传入值为非数组
if
(
!
Array
.
isArray
(
this
.
value
))
{
if
(
this
.
options
.
some
((
v
)
=>
v
.
value
==
this
.
value
))
return
false
;
this
.
unmatchArray
.
push
(
this
.
value
);
return
true
;
}
// 传入值为Array
this
.
value
.
forEach
((
item
)
=>
{
if
(
!
this
.
options
.
some
((
v
)
=>
v
.
value
==
item
))
this
.
unmatchArray
.
push
(
item
);
});
return
true
;
}
this
.
unmatchArray
=
[]
// 没有value不显示
return
false
;
if
(
this
.
value
===
null
||
typeof
this
.
value
===
'undefined'
||
this
.
value
===
''
||
this
.
options
.
length
===
0
)
return
false
// 传入值为数组
let
unmatch
=
false
// 添加一个标志来判断是否有未匹配项
this
.
values
.
forEach
(
item
=>
{
if
(
!
this
.
options
.
some
(
v
=>
v
.
value
===
item
))
{
this
.
unmatchArray
.
push
(
item
)
unmatch
=
true
// 如果有未匹配项,将标志设置为true
}
})
return
unmatch
// 返回标志的值
},
},
filters
:
{
handleArray
(
array
)
{
if
(
array
.
length
===
0
)
return
""
;
if
(
array
.
length
===
0
)
return
''
;
return
array
.
reduce
((
pre
,
cur
)
=>
{
return
pre
+
" "
+
cur
;
return
pre
+
' '
+
cur
;
})
}
}
,
}
};
</
script
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论