Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
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
tianzhuanghu
ant-design-pro-vue
Commits
c84087e7
Unverified
Commit
c84087e7
authored
Mar 26, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: TagSelect
parent
d822ccf0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
4 deletions
+100
-4
TagSelectOption.jsx
src/components/TagSelect/TagSelectOption.jsx
+46
-0
index.jsx
src/components/TagSelect/index.jsx
+54
-4
No files found.
src/components/TagSelect/TagSelectOption.jsx
0 → 100644
View file @
c84087e7
import
{
Tag
}
from
'ant-design-vue'
const
{
CheckableTag
}
=
Tag
export
default
{
name
:
'TagSelectOption'
,
props
:
{
prefixCls
:
{
type
:
String
,
default
:
'ant-pro-tag-select-option'
},
defaultValue
:
{
type
:
[
String
,
Number
,
Object
],
required
:
true
},
value
:
{
type
:
[
String
,
Number
,
Object
],
required
:
true
},
checked
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
val
:
this
.
value
||
this
.
defaultValue
||
null
,
localChecked
:
this
.
checked
||
false
}
},
methods
()
{
},
render
()
{
const
{
$slots
,
$props
,
val
}
=
this
const
props
=
{
...
$props
}
const
onChange
=
(
checked
)
=>
{
this
.
localChecked
=
checked
this
.
$emit
(
'change'
,
{
val
,
checked
})
}
return
(<
CheckableTag
{
...
{
props
}}
onChange=
{
onChange
}
>
{
$slots
.
default
}
</
CheckableTag
>)
}
}
src/components/TagSelect/index.jsx
View file @
c84087e7
import
PropTypes
from
'ant-design-vue/es/_util/vue-types'
// TODO
import
TagSelectOption
from
'./TagSelectOption.jsx'
import
{
filterEmpty
}
from
'@/components/_util/util'
export
default
{
name
:
'TagSelect'
,
props
:
{
defaultValue
:
{
type
:
[
PropTypes
.
arrayOf
(
String
),
PropTypes
.
arrayOf
(
Number
)]
,
default
:
()
=>
{}
prefixCls
:
{
type
:
String
,
default
:
'ant-pro-tag-select'
},
defaultValue
:
{
type
:
PropTypes
.
object
,
default
:
()
=>
[]
,
value
:
{
type
:
PropTypes
.
object
,
default
:
()
=>
[]
,
expandable
:
{
type
:
Boolean
,
default
:
false
...
...
@@ -15,5 +25,45 @@ export default {
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
expand
:
false
,
val
:
this
.
value
||
this
.
defaultValue
||
[]
}
},
methods
:
{
onChange
()
{
},
// render option
renderTag
({
value
,
checked
})
{
const
props
=
{
checked
:
checked
,
value
:
value
}
return
(
<
TagSelectOption
{
...
{
props
}}
/>
)
},
renderTags
(
items
)
{
return
items
.
map
(
item
=>
this
.
renderTag
(
item
))
}
}
},
render
()
{
const
{
$props
:
{
prefixCls
},
renderTags
}
=
this
const
classString
=
{
[
`
${
prefixCls
}
`
]:
true
}
const
tagItems
=
filterEmpty
(
this
.
$slots
.
default
)
const
tagItemDom
=
(
tagItems
&&
tagItems
.
length
>
0
)
&&
renderTags
(
tagItems
)
||
null
return
(
<
div
class=
{
classString
}
>
{
tagItemDom
}
</
div
>
)
}
}
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