-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathradio.ts
39 lines (32 loc) · 943 Bytes
/
radio.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Component } from "./core";
class RadioButton extends Component {
text: string;
constructor(props:any) {
super(props);
this.htmlString = /*html*/ `<label>
<input type='radio'>
<span class="checkable">${this.text}</span>
</label>`;
//console.log(this.htmlString);
this.createNode();
///
if (props) {
if (props.parent) {
this.appendTo(props.parent);
}
if (props.text) {
this.text = props.text;
}
}
}
getChecked() {
return this.node.options[this.node.RadioButtonedIndex].value;
}
setChecked(choice:any) {
this.node.options[this.node.RadioButtonedIndex].value = choice;
}
click(clickFN:any) {
this.node.addEventListener("click", clickFN);
}
}
export { RadioButton };