I use ASP NET with VueJS. ASP NET render view component:
<script type="text/x-template" id="form-template">
@if (string.IsNullOrEmpty(Model.LastName))
{
<input asp-for="LastName" class="form-control" maxlength="100" autofocus required />
}
else
{
<input asp-for="LastName" class="form-control" maxlength="100" required />
}
</script>
My action on C#:
public async Task<ActionResult<ViewComponent>> GetAdditionalFormRegistrationComponentAsync()
{
var customerViewModel = new CustomerAdditionFormViewModel
{
LastName = "русские символы"
};
return ViewComponent("FormRegistration", customerViewModel);
}
}
ViewComponent:
public Task<IViewComponentResult> InvokeAsync(CustomerAdditionFormViewModel customerViewModel)
{
return Task.Run<IViewComponentResult>(() => View(customerViewModel));
}
LastName write in English input value OK. But if LastName fill in russian I get:
How fix this?
question from:
https://stackoverflow.com/questions/65830868/how-use-script-type-text-x-template-with-multilanguage 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…