discourse/app/assets/javascripts/wizard/components/radio-button.js.es6
2019-11-07 15:38:28 -06:00

22 lines
490 B
JavaScript

import { next } from "@ember/runloop";
import Component from "@ember/component";
import { observes, on } from "discourse-common/utils/decorators";
export default Component.extend({
tagName: "label",
click(e) {
e.preventDefault();
this.onChange(this.radioValue);
},
@observes("value")
@on("init")
updateVal() {
const checked = this.value === this.radioValue;
next(
() => (this.element.querySelector("input[type=radio]").checked = checked)
);
}
});