升级 - Mvc 迁移. NetCore
1. 类库迁移
直接拷贝到netcore 类库下,修改命名空间即可;
2. 迁移包(不同项目需要迁移的包不一下)
using System.Web.Script.Serialization; ---》using Nancy.Json;
3. Action 跳转
View 写法:
@await Component.InvokeAsync("IndexMapSpot", new { PageType = "show_page" })
// @*@{Html.Action("IndexMapSpot", "Matrix", new { PageType = "show_page" });}*@
定义实现IndexMapSpotViewComponent
namespace Techub.QHNY.Web.Components
{
public class IndexMapSpotViewComponent : ViewComponent
{
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public IViewComponentResult Invoke(string PageType = "", string from = "0")
{
ViewBag.page = PageType;
ViewBag.from = from;
return View("~/Views/Matrix/IndexMapSpot.cshtml");
}
}
}
4. JsonResult 数据


5. @Scripts @Styles
改成具体的文件链接,参考项目默认的layount
<link href="~/Content/bundles.min.css" rel="stylesheet" /> <script src="~/Scripts/bundles.min.js"></script>
6. 静态文件脚本


浙公网安备 33010602011771号