Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6edd64f1
authored
Aug 04, 2024
by
GoldenZqqqq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: DictTag组件加字符串分隔符props,更灵活定义split字符串的分隔符
parent
c015b2e8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
src/components/DictTag/src/DictTag.vue
+7
-2
No files found.
src/components/DictTag/src/DictTag.vue
View file @
6edd64f1
...
...
@@ -15,6 +15,11 @@ export default defineComponent({
value
:
{
type
:
[
String
,
Number
,
Boolean
,
Array
],
required
:
true
},
// 字符串分隔符 只有当 props.value 传入值为字符串时有效
sepSymbol
:
{
type
:
String
as
PropType
<
string
>
,
default
:
','
}
},
setup
(
props
)
{
...
...
@@ -23,9 +28,9 @@ export default defineComponent({
if
(
isNumber
(
props
.
value
))
{
return
[
String
(
props
.
value
)]
}
// 2.是字符串(进一步判断是否有
','
)
// 2.是字符串(进一步判断是否有
包含分隔符号 -> props.sepSymbol
)
else
if
(
isString
(
props
.
value
))
{
return
props
.
value
.
includes
(
','
)
?
props
.
value
.
split
(
','
)
:
[
String
(
props
.
value
)]
return
props
.
value
.
split
(
props
.
sepSymbol
)
}
// 3.数组
else
if
(
isArray
(
props
.
value
))
{
...
...
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