Quiz_example/Components/Pages/Question.razor
2024-01-13 18:30:57 +02:00

33 lines
No EOL
976 B
Text

<div class="ques">
<h1>@question</h1>
<form>
<input type="radio" id="option1" name="radioGroup" value="option1" @onchange="sub">
<label for="option1">@opt1</label><br>
<input type="radio" id="option2" name="radioGroup" value="option2" @onchange="sub">
<label for="option2">@opt2</label><br>
<input type="radio" id="option3" name="radioGroup" value="option3" @onchange="sub">
<label for="option3">@opt3</label><br>
</form>
</div>
@code {
// Callback property to receive the callback from the parent
[Parameter]
public Action<string> OnCallback { get; set; }
[Parameter]
public string question { get; set; }
[Parameter]
public string opt1 {get; set;}
[Parameter]
public string opt2 {get; set;}
[Parameter]
public string opt3 {get; set;}
public void sub(ChangeEventArgs e){
OnCallback?.Invoke(e.Value.ToString());
//Console.WriteLine("helo");
}
}