Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
aa197a91
authored
2023-07-19 16:00:56 +0800
by
yuanbo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加注释
1 parent
c5c9c87e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
9 deletions
src/components/CheckBox/checkbox.vue
src/components/CheckBox/checkbox.vue
View file @
aa197a9
...
...
@@ -54,12 +54,20 @@ export default {
computed
:
{
model
:
{
/**
* @description: get
* @author: renchao
*/
get
()
{
return
this
.
isGroup
?
this
.
store
:
this
.
value
!==
undefined
?
this
.
value
:
this
.
selfModel
;
},
/**
* @description: set
* @param {*} val
* @author: renchao
*/
set
(
val
)
{
if
(
this
.
isGroup
)
{
this
.
isLimitExceeded
=
false
;
...
...
@@ -80,6 +88,10 @@ export default {
}
},
/**
* @description: isChecked
* @author: renchao
*/
isChecked
()
{
if
({}.
toString
.
call
(
this
.
model
)
===
'[object Boolean]'
)
{
return
this
.
model
;
...
...
@@ -89,7 +101,10 @@ export default {
return
this
.
model
===
this
.
trueLabel
;
}
},
/**
* @description: isGroup
* @author: renchao
*/
isGroup
()
{
let
parent
=
this
.
$parent
;
while
(
parent
)
{
...
...
@@ -102,29 +117,44 @@ export default {
}
return
false
;
},
/**
* @description: store
* @author: renchao
*/
store
()
{
return
this
.
_checkboxGroup
?
this
.
_checkboxGroup
.
value
:
this
.
value
;
},
/* used to make the isDisabled judgment under max/min props */
/**
* @description: isLimitDisabled
* @author: renchao
*/
isLimitDisabled
()
{
const
{
max
,
min
}
=
this
.
_checkboxGroup
;
return
!!
(
max
||
min
)
&&
(
this
.
model
.
length
>=
max
&&
!
this
.
isChecked
)
||
(
this
.
model
.
length
<=
min
&&
this
.
isChecked
);
},
/**
* @description: isDisabled
* @author: renchao
*/
isDisabled
()
{
return
this
.
isGroup
?
this
.
_checkboxGroup
.
disabled
||
this
.
disabled
||
(
this
.
elForm
||
{}).
disabled
||
this
.
isLimitDisabled
:
this
.
disabled
||
(
this
.
elForm
||
{}).
disabled
;
},
/**
* @description: _elFormItemSize
* @author: renchao
*/
_elFormItemSize
()
{
return
(
this
.
elFormItem
||
{}).
elFormItemSize
;
},
/**
* @description: checkboxSize
* @author: renchao
*/
checkboxSize
()
{
const
temCheckboxSize
=
this
.
size
||
this
.
_elFormItemSize
||
(
this
.
$ELEMENT
||
{}).
size
;
return
this
.
isGroup
...
...
@@ -149,6 +179,10 @@ export default {
},
methods
:
{
/**
* @description: addToStore
* @author: renchao
*/
addToStore
()
{
if
(
Array
.
isArray
(
this
.
model
)
&&
...
...
@@ -159,6 +193,10 @@ export default {
this
.
model
=
this
.
trueLabel
||
true
;
}
},
/**
* @description: handleChange
* @author: renchao
*/
handleChange
(
ev
)
{
if
(
this
.
isLimitExceeded
)
return
;
let
value
;
...
...
@@ -175,16 +213,26 @@ export default {
});
}
},
/**
* @description: created
* @author: renchao
*/
created
()
{
this
.
checked
&&
this
.
addToStore
();
},
/**
* @description: mounted
* @author: renchao
*/
mounted
()
{
// 为indeterminate元素 添加aria-controls 属性
if
(
this
.
indeterminate
)
{
this
.
$el
.
setAttribute
(
'aria-controls'
,
this
.
controls
);
}
},
/**
* @description: watch
* @author: renchao
*/
watch
:
{
value
(
value
)
{
this
.
dispatch
(
'ElFormItem'
,
'el.form.change'
,
value
);
...
...
Please
register
or
sign in
to post a comment