discourse/app/assets/javascripts/wizard/components/radio-button.js.es6

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
490 B
Plaintext
Raw Normal View History

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