Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
e56f52ff
Commit
e56f52ff
authored
Dec 02, 2016
by
baiyaaaaa
Committed by
cinwell.li
Dec 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix radio dynamic init bug (#1514)
parent
d3afe22e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
51 deletions
+50
-51
packages/checkbox/src/checkbox.vue
packages/checkbox/src/checkbox.vue
+0
-6
packages/radio/src/radio-button.vue
packages/radio/src/radio-button.vue
+21
-15
packages/radio/src/radio-group.vue
packages/radio/src/radio-group.vue
+0
-4
packages/radio/src/radio.vue
packages/radio/src/radio.vue
+28
-25
test/unit/index.js
test/unit/index.js
+1
-1
No files found.
packages/checkbox/src/checkbox.vue
View file @
e56f52ff
...
@@ -103,12 +103,6 @@
...
@@ -103,12 +103,6 @@
falseLabel
:
[
String
,
Number
]
falseLabel
:
[
String
,
Number
]
},
},
data
()
{
return
{
isGroup
:
false
};
},
methods
:
{
methods
:
{
addToStore
()
{
addToStore
()
{
if
(
Array
.
isArray
(
this
.
model
))
{
if
(
Array
.
isArray
(
this
.
model
))
{
...
...
packages/radio/src/radio-button.vue
View file @
e56f52ff
...
@@ -3,33 +3,39 @@
...
@@ -3,33 +3,39 @@
name
:
'
ElRadioButton
'
,
name
:
'
ElRadioButton
'
,
props
:
{
props
:
{
label
:
{
label
:
{},
type
:
[
String
,
Number
],
required
:
true
},
disabled
:
Boolean
,
disabled
:
Boolean
,
name
:
String
name
:
String
},
},
data
()
{
return
{
size
:
this
.
$parent
.
size
};
},
computed
:
{
computed
:
{
value
:
{
value
:
{
get
()
{
get
()
{
return
this
.
$parent
.
value
;
return
this
.
_radioGroup
.
value
;
},
},
set
(
newV
alue
)
{
set
(
v
alue
)
{
this
.
$parent
.
$emit
(
'
input
'
,
newV
alue
);
this
.
_radioGroup
.
$emit
(
'
input
'
,
v
alue
);
}
}
},
},
_radioGroup
()
{
let
parent
=
this
.
$parent
;
while
(
parent
)
{
if
(
parent
.
$options
.
componentName
!==
'
ElRadioGroup
'
)
{
parent
=
parent
.
$parent
;
}
else
{
return
parent
;
}
}
return
false
;
},
activeStyle
()
{
activeStyle
()
{
return
{
return
{
backgroundColor
:
this
.
$parent
.
fill
,
backgroundColor
:
this
.
_radioGroup
.
fill
,
borderColor
:
this
.
$parent
.
fill
,
borderColor
:
this
.
_radioGroup
.
fill
,
color
:
this
.
$parent
.
textColor
color
:
this
.
_radioGroup
.
textColor
};
};
},
size
()
{
return
this
.
_radioGroup
.
size
;
}
}
}
}
};
};
...
...
packages/radio/src/radio-group.vue
View file @
e56f52ff
...
@@ -23,12 +23,8 @@
...
@@ -23,12 +23,8 @@
watch
:
{
watch
:
{
value
(
value
)
{
value
(
value
)
{
this
.
$emit
(
'
change
'
,
value
);
this
.
$emit
(
'
change
'
,
value
);
this
.
broadcast
(
'
ElRadio
'
,
'
initData
'
,
value
);
this
.
dispatch
(
'
ElFormItem
'
,
'
el.form.change
'
,
[
this
.
value
]);
this
.
dispatch
(
'
ElFormItem
'
,
'
el.form.change
'
,
[
this
.
value
]);
}
}
},
mounted
()
{
this
.
broadcast
(
'
ElRadio
'
,
'
initData
'
,
this
.
value
);
}
}
};
};
</
script
>
</
script
>
...
...
packages/radio/src/radio.vue
View file @
e56f52ff
...
@@ -4,14 +4,14 @@
...
@@ -4,14 +4,14 @@
<span
class=
"el-radio__inner"
<span
class=
"el-radio__inner"
:class=
"
{
:class=
"
{
'is-disabled': disabled,
'is-disabled': disabled,
'is-checked':
store
=== label,
'is-checked':
model
=== label,
'is-focus': focus
'is-focus': focus
}">
</span>
}">
</span>
<input
<input
class=
"el-radio__original"
class=
"el-radio__original"
:value=
"label"
:value=
"label"
type=
"radio"
type=
"radio"
v-model=
"
store
"
v-model=
"
model
"
@
focus=
"focus = true"
@
focus=
"focus = true"
@
blur=
"focus = false"
@
blur=
"focus = false"
:name=
"name"
:name=
"name"
...
@@ -34,42 +34,45 @@
...
@@ -34,42 +34,45 @@
componentName
:
'
ElRadio
'
,
componentName
:
'
ElRadio
'
,
props
:
{
props
:
{
value
:
[
String
,
Number
],
value
:
{},
label
:
{
label
:
{},
type
:
[
String
,
Number
],
required
:
true
},
disabled
:
Boolean
,
disabled
:
Boolean
,
name
:
String
name
:
String
},
},
data
()
{
data
()
{
return
{
return
{
focus
:
false
,
focus
:
false
isGroup
:
false
,
store
:
this
.
value
};
};
},
},
watch
:
{
computed
:
{
store
(
store
)
{
isGroup
()
{
if
(
this
.
isGroup
)
{
let
parent
=
this
.
$parent
;
this
.
dispatch
(
'
ElRadioGroup
'
,
'
input
'
,
store
);
while
(
parent
)
{
}
else
{
if
(
parent
.
$options
.
componentName
!==
'
ElRadioGroup
'
)
{
this
.
$emit
(
'
input
'
,
store
);
parent
=
parent
.
$parent
;
}
else
{
this
.
_radioGroup
=
parent
;
return
true
;
}
}
}
return
false
;
},
},
value
(
val
)
{
model
:
{
this
.
store
=
val
;
get
()
{
}
return
this
.
isGroup
?
this
.
_radioGroup
.
value
:
this
.
value
;
},
},
created
()
{
set
(
val
)
{
this
.
$on
(
'
initData
'
,
data
=>
{
if
(
this
.
isGroup
)
{
this
.
store
=
data
;
this
.
dispatch
(
'
ElRadioGroup
'
,
'
input
'
,
[
val
]);
this
.
isGroup
=
true
;
}
else
{
});
this
.
$emit
(
'
input
'
,
val
);
}
}
}
}
}
};
};
</
script
>
</
script
>
test/unit/index.js
View file @
e56f52ff
...
@@ -4,7 +4,7 @@ Function.prototype.bind = require('function-bind');
...
@@ -4,7 +4,7 @@ Function.prototype.bind = require('function-bind');
require
(
'
packages/theme-default/src/index.css
'
);
require
(
'
packages/theme-default/src/index.css
'
);
// require all test files (files that ends with .spec.js)
// require all test files (files that ends with .spec.js)
const
testsContext
=
require
.
context
(
'
./specs
'
,
true
,
/
tabs
\.
spec$/
);
const
testsContext
=
require
.
context
(
'
./specs
'
,
true
,
/
\.
spec$/
);
testsContext
.
keys
().
forEach
(
testsContext
);
testsContext
.
keys
().
forEach
(
testsContext
);
// require all src files except main.js for coverage.
// require all src files except main.js for coverage.
...
...
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