File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
src/directives/public/model Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ module.exports = {
5
5
bind : function ( ) {
6
6
var self = this
7
7
var el = this . el
8
+ var number = this . param ( 'number' ) != null
9
+
10
+ this . getValue = function ( ) {
11
+ return el . hasOwnProperty ( '_value' )
12
+ ? el . _value
13
+ : number
14
+ ? _ . toNumber ( el . value )
15
+ : el . value
16
+ }
8
17
9
18
function getBooleanValue ( ) {
10
19
var val = el . checked
@@ -20,7 +29,7 @@ module.exports = {
20
29
this . listener = function ( ) {
21
30
var model = self . _watcher . value
22
31
if ( _ . isArray ( model ) ) {
23
- var val = getValue ( el )
32
+ var val = self . getValue ( )
24
33
if ( el . checked ) {
25
34
if ( _ . indexOf ( model , val ) < 0 ) {
26
35
model . push ( val )
@@ -42,7 +51,7 @@ module.exports = {
42
51
update : function ( value ) {
43
52
var el = this . el
44
53
if ( _ . isArray ( value ) ) {
45
- el . checked = _ . indexOf ( value , getValue ( el ) ) > - 1
54
+ el . checked = _ . indexOf ( value , this . getValue ( ) ) > - 1
46
55
} else {
47
56
if ( el . hasOwnProperty ( '_trueValue' ) ) {
48
57
el . checked = _ . looseEqual ( value , el . _trueValue )
@@ -52,9 +61,3 @@ module.exports = {
52
61
}
53
62
}
54
63
}
55
-
56
- function getValue ( el ) {
57
- return el . hasOwnProperty ( '_value' )
58
- ? el . _value
59
- : el . value
60
- }
You can’t perform that action at this time.
0 commit comments