2018-06-15 23:03:24 +08:00
|
|
|
import { observes, on } from "ember-addons/ember-computed-decorators";
|
2016-09-10 03:57:44 +08:00
|
|
|
|
|
|
|
export default Ember.Component.extend({
|
2018-06-15 23:03:24 +08:00
|
|
|
tagName: "label",
|
2016-09-10 03:57:44 +08:00
|
|
|
|
|
|
|
click(e) {
|
|
|
|
e.preventDefault();
|
2018-06-15 23:03:24 +08:00
|
|
|
this.sendAction("onChange", this.get("radioValue"));
|
2016-09-10 03:57:44 +08:00
|
|
|
},
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
@observes("value")
|
|
|
|
@on("init")
|
2016-09-10 03:57:44 +08:00
|
|
|
updateVal() {
|
2018-06-15 23:03:24 +08:00
|
|
|
const checked = this.get("value") === this.get("radioValue");
|
|
|
|
Ember.run.next(() => this.$("input[type=radio]").prop("checked", checked));
|
2016-09-10 03:57:44 +08:00
|
|
|
}
|
|
|
|
});
|