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 = {
55 bind : function ( ) {
66 var self = this
77 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+ }
817
918 function getBooleanValue ( ) {
1019 var val = el . checked
@@ -20,7 +29,7 @@ module.exports = {
2029 this . listener = function ( ) {
2130 var model = self . _watcher . value
2231 if ( _ . isArray ( model ) ) {
23- var val = getValue ( el )
32+ var val = self . getValue ( )
2433 if ( el . checked ) {
2534 if ( _ . indexOf ( model , val ) < 0 ) {
2635 model . push ( val )
@@ -42,7 +51,7 @@ module.exports = {
4251 update : function ( value ) {
4352 var el = this . el
4453 if ( _ . isArray ( value ) ) {
45- el . checked = _ . indexOf ( value , getValue ( el ) ) > - 1
54+ el . checked = _ . indexOf ( value , this . getValue ( ) ) > - 1
4655 } else {
4756 if ( el . hasOwnProperty ( '_trueValue' ) ) {
4857 el . checked = _ . looseEqual ( value , el . _trueValue )
@@ -52,9 +61,3 @@ module.exports = {
5261 }
5362 }
5463}
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