ajxnetcore
1.0.0

ASP.NET Core 애플리케이션을 단일 페이지 응용 프로그램으로 전환하는 혁신적인 방법 인 목표는 SPA를 만들고 서버 및 클라이언트 측면에서 소프트웨어 성능을 향상시키는 동시에 개발자의 노력을 줄이는 것입니다.
단일 페이지 애플리케이션은 페이지의로드 시간을 줄이고 서버에서 클라이언트로 데이터 전송량을 줄일 수 있습니다. 왜 ? 단일 페이지 애플리케이션을 생성하기 위해 ASP.NET Core MVC 응용 프로그램에서 AngularJS, React, Vuejs, Knockout, Meteor 등과 같은 JavaScript 프레임 워크로 작업하는 동안 몇 가지 진통 점이 있습니다.
여기에서 JS 파일을 다운로드하여 wwwroot 폴더 아래 JS 디렉토리에 넣으십시오.
"_viewstart.cshtml"파일을 대체하십시오
@{
if (Context.Request.Headers["X-Requested-With"] == "XMLHttpRequest")
{
Context.Response.Headers["Location"] = Microsoft.AspNetCore.Http.Extensions.UriHelper.GetDisplayUrl(Context.Request);
Context.Response.Headers["Cache-Control"] = "no-store";
}
else
{
Layout = "_Layout";
}
}
"_layout.cshtml"파일에 ajxnetcore.js 파일의 참조를 추가하십시오.
<script src="~/js/ajxnetcore.js"></script>
이와 같은 ID로 렌더 바디 ()을 div 안에 넣으십시오.
<div id="myid">@RenderBody()</div>
Finnaly 닫는 바디 태그에 대한 다음 줄을 추가하십시오.
<script>
$(function() {
$('#myid').ajxnetcore();
})
</script>
ajxnetcore.demo 프로젝트를 다운로드 하여이 프로젝트를 테스트 할 수 있습니다.

이 프로젝트는 MIT 라이센스 아래에 있습니다
Copyright (c) 2017 Amine Smahi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.