Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 061be1cb
authored
Oct 26, 2023
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
TagEllipsis优化扩展
1 parent
273ba4a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
vue3-lw-pc/src/components/TagEllipsis.vue
vue3-lw-pc/src/components/TagEllipsis.vue
View file @
061be1c
...
@@ -3,14 +3,17 @@ export default {
...
@@ -3,14 +3,17 @@ export default {
name
:
'TagEllipsis'
,
name
:
'TagEllipsis'
,
components
:
{},
components
:
{},
props
:
{
props
:
{
// 可传入数组,或逗号隔开的数组字符串,示例:['1','2'] 或 [{defaultProps:1}] 或 '1,2'
list
:
{
list
:
{
type
:
Array
,
type
:
[
Array
,
String
]
,
default
:
()
=>
[],
default
:
()
=>
[],
},
},
// 限制显示多少个元素后使用省略号,默认:2
limit
:
{
limit
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
2
,
default
:
2
,
},
},
// list对象数组形式元素的文字回显字段,默认:name
defaultProps
:
{
defaultProps
:
{
type
:
String
,
type
:
String
,
default
:
'name'
,
default
:
'name'
,
...
@@ -25,7 +28,9 @@ export default {
...
@@ -25,7 +28,9 @@ export default {
},
},
computed
:
{
computed
:
{
_list
()
{
_list
()
{
return
this
.
list
?.
filter
((
e
)
=>
(
typeof
e
===
'string'
?
e
:
e
[
this
.
defaultProps
]))
return
(
typeof
this
.
list
===
'string'
?
this
.
list
?.
split
(
','
)
:
this
.
list
)?.
filter
((
e
)
=>
typeof
e
===
'string'
?
e
:
e
[
this
.
defaultProps
],
)
},
},
},
},
watch
:
{},
watch
:
{},
...
@@ -42,7 +47,7 @@ export default {
...
@@ -42,7 +47,7 @@ export default {
<
template
>
<
template
>
<div
class=
"tag-ellipsis"
v-if=
"_list?.length || emptyText"
>
<div
class=
"tag-ellipsis"
v-if=
"_list?.length || emptyText"
>
<div
v-if=
"!_list?.length"
>
{{
typeof
emptyText
===
'string'
?
emptyText
:
'
暂无标签
'
}}
</div>
<div
v-if=
"!_list?.length"
>
{{
typeof
emptyText
===
'string'
?
emptyText
:
'
无
'
}}
</div>
<div
class=
"tags"
v-else-if=
"_list.length
<
= +limit">
<div
class=
"tags"
v-else-if=
"_list.length
<
= +limit">
<el-tag
v-bind=
"elTagProps"
v-for=
"(item, unique) in _list"
:key=
"unique"
>
<el-tag
v-bind=
"elTagProps"
v-for=
"(item, unique) in _list"
:key=
"unique"
>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment