我有一个简单的ViewComponent在浏览器chrome和Firefox中正常工作但不能在浏览器Edge\IE 11中工作.
该组件显示时间(仅举例).
显示Chrome和Firefox时间.
边缘浏览器\ IE 11,时间仅在页面第一次显示时显示并保持不变,时间被"冻结".
但
当我打开浏览器边缘开发工具以及IE 11时,组件开始正常工作并显示当前时间(就像其他浏览器一样)
当我关闭F12开发工具时,组件停止工作(时间"冻结").
并重复 - F12 打开组件工作,F12 关闭组件停止工作.
我在这里错过了什么吗?
附上过程的简单代码谢谢
HomeController的:
public IActionResult GetTime()
{
return ViewComponent("GetTime");
//// var time = DateTime.Now.ToString("h:mm:ss");
//// return Content($"The current time is {time}");
}
Run Code Online (Sandbox Code Playgroud)
GetTimeViewComponent:
public class GetTimeViewComponent : ViewComponent
{
public IViewComponentResult Invoke()
{
var model = new string[]
{
"Hello", DateTime.Now.ToString("h:mm:ss") , "the", "view", "component."
};
return View("Default", model);
}
}
Run Code Online (Sandbox Code Playgroud)
默认: …