久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='p3kyn'><style id='p3kyn'><dir id='p3kyn'><q id='p3kyn'></q></dir></style></legend>

  • <tfoot id='p3kyn'></tfoot>

      <bdo id='p3kyn'></bdo><ul id='p3kyn'></ul>

      <i id='p3kyn'><tr id='p3kyn'><dt id='p3kyn'><q id='p3kyn'><span id='p3kyn'><b id='p3kyn'><form id='p3kyn'><ins id='p3kyn'></ins><ul id='p3kyn'></ul><sub id='p3kyn'></sub></form><legend id='p3kyn'></legend><bdo id='p3kyn'><pre id='p3kyn'><center id='p3kyn'></center></pre></bdo></b><th id='p3kyn'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='p3kyn'><tfoot id='p3kyn'></tfoot><dl id='p3kyn'><fieldset id='p3kyn'></fieldset></dl></div>

      1. <small id='p3kyn'></small><noframes id='p3kyn'>

      2. 用于 ajax 刷新的 Viewcomponent 替代方案

        Viewcomponent alternative for ajax refresh(用于 ajax 刷新的 Viewcomponent 替代方案)

              <tbody id='mvMLa'></tbody>

              <small id='mvMLa'></small><noframes id='mvMLa'>

              • <bdo id='mvMLa'></bdo><ul id='mvMLa'></ul>

                  <i id='mvMLa'><tr id='mvMLa'><dt id='mvMLa'><q id='mvMLa'><span id='mvMLa'><b id='mvMLa'><form id='mvMLa'><ins id='mvMLa'></ins><ul id='mvMLa'></ul><sub id='mvMLa'></sub></form><legend id='mvMLa'></legend><bdo id='mvMLa'><pre id='mvMLa'><center id='mvMLa'></center></pre></bdo></b><th id='mvMLa'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='mvMLa'><tfoot id='mvMLa'></tfoot><dl id='mvMLa'><fieldset id='mvMLa'></fieldset></dl></div>
                  <tfoot id='mvMLa'></tfoot>
                  <legend id='mvMLa'><style id='mvMLa'><dir id='mvMLa'><q id='mvMLa'></q></dir></style></legend>
                1. 本文介紹了用于 ajax 刷新的 Viewcomponent 替代方案的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個視圖組件,其中包含一些嵌入到各個頁面中的可重用業務邏輯.這一直運作良好.但是,我現在需要使用 ajax 刷新視圖組件.

                  I have a viewcomponent that contains some reusable business logic that embed in various pages. This has been working fine. However, I now have a requirement to refresh the viewcomponent using ajax.

                  有沒有辦法做到這一點?根據我的閱讀,這是不可能的,盡管該信息有點過時了.如果不可能,最好的選擇是什么?

                  Is there any way to accomplish this? From what I have read, it is not possible, although that info was a bit outdated. If it is not possible, what is the best alternative?

                  推薦答案

                  在 beta7 上,現在可以直接從控制器返回 ViewComponent.檢查 公告

                  On beta7 it is now possible to return a ViewComponent directly from a controller. Check the MVC/Razor section of the announcement

                  MVC 中新增的 ViewComponentResult 使得返回結果變得容易來自動作的 ViewComponent.這使您可以輕松地暴露ViewComponent 作為獨立端點的邏輯.

                  The new ViewComponentResult in MVC makes it easy to return the result of a ViewComponent from an action. This allows you to easily expose the logic of a ViewComponent as a standalone endpoint.

                  所以你可以有一個像這樣的簡單視圖組件:

                  So you could have a simple view component like this:

                  [ViewComponent(Name = "MyViewComponent")]
                  public class MyViewComponent : ViewComponent
                  {
                      public IViewComponentResult Invoke()
                      {
                          var time = DateTime.Now.ToString("h:mm:ss");
                          return Content($"The current time is {time}");
                      }
                  }
                  

                  在控制器中創建一個方法,例如:

                  Create a method in a controller like:

                  public IActionResult MyViewComponent()
                  {
                      return ViewComponent("MyViewComponent");
                  }
                  

                  并且比我快速而骯臟的 ajax 刷新做得更好:

                  And do a better job than my quick and dirty ajax refresh:

                  var container = $("#myComponentContainer");
                  var refreshComponent = function () {
                      $.get("/Home/MyViewComponent", function (data) { container.html(data); });
                  };
                  
                  $(function () { window.setInterval(refreshComponent, 1000); });
                  

                  當然,在 beta7 之前,您可以創建一個視圖作為@eedam 建議的解決方法,或者使用 這些答案

                  Of course, prior to beta7 you could create a view as the workaround suggested by @eedam or use the approach described in these answers

                  這篇關于用于 ajax 刷新的 Viewcomponent 替代方案的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Leaflet: how to swap coordinates received from an ajax call(傳單:如何交換從 ajax 調用接收到的坐標)
                  How to render leaflet map when in hidden quot;display: none;quot; parent(隱藏“顯示:無時如何渲染傳單地圖父母)
                  Handling ajax-request in leaflet map(在傳單地圖中處理 ajax 請求)
                  Show Image in Leaflet Popup(在傳單彈出窗口中顯示圖像)
                  Submitting a razor form using JQuery AJAX in MVC6 using the built-in functionality(使用內置功能在 MVC6 中使用 JQuery AJAX 提交剃刀表單)
                  <legend id='KdOkP'><style id='KdOkP'><dir id='KdOkP'><q id='KdOkP'></q></dir></style></legend>

                        <tbody id='KdOkP'></tbody>
                        <i id='KdOkP'><tr id='KdOkP'><dt id='KdOkP'><q id='KdOkP'><span id='KdOkP'><b id='KdOkP'><form id='KdOkP'><ins id='KdOkP'></ins><ul id='KdOkP'></ul><sub id='KdOkP'></sub></form><legend id='KdOkP'></legend><bdo id='KdOkP'><pre id='KdOkP'><center id='KdOkP'></center></pre></bdo></b><th id='KdOkP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KdOkP'><tfoot id='KdOkP'></tfoot><dl id='KdOkP'><fieldset id='KdOkP'></fieldset></dl></div>
                            <bdo id='KdOkP'></bdo><ul id='KdOkP'></ul>

                            <small id='KdOkP'></small><noframes id='KdOkP'>

                            <tfoot id='KdOkP'></tfoot>
                            主站蜘蛛池模板: 久草网站 | 激情三区 | 午夜影院 | 亚洲精品视频在线观看免费 | 高清色| 成人精品| 国产精品久久久亚洲 | 成人精品免费视频 | 日韩一二三区 | 99精品国产一区二区青青牛奶 | 免费国产视频在线观看 | 久草热在线 | 秋霞影院一区二区 | 成人精品一区二区三区中文字幕 | 成人福利在线视频 | 久久久久久久久久毛片 | 中文字幕一区二区三区在线观看 | 91在线网站 | 一级片av| 精品久久久久久亚洲综合网站 | 91麻豆产精品久久久久久 | 电影91久久久 | 亚洲免费视频播放 | 在线观看视频一区 | 涩涩视频在线观看免费 | 成人免费视频网站在线观看 | 超碰91在线| 久久网一区二区 | 日韩成人 | 国产精品美女久久久 | 91精品国产综合久久福利软件 | 久久久蜜臀国产一区二区 | 欧美一级特黄aaa大片在线观看 | 精品少妇一区二区三区在线播放 | 亚洲精品在线免费观看视频 | 日韩欧美一级精品久久 | 亚洲一区视频在线 | 久久精品这里精品 | 依人成人 | 国产精品亚洲二区 | 久久久一区二区三区 |