简体   繁体   中英

How to load Blazor component in MVC partial view from javascript

我有 MVC .net 6 项目,其中有很多部分视图。当我想通过单击某个元素来动态加载部分视图时,我必须执行以下操作:

$.ajax({
            type: "GET",
            url: url,
            success: function (data) {
                $partialPlaceholder.html(data);          
            }});

There is one "hack" solution to this. Putting <script src="_framework/blazor.server.js"></script> right after component in partial will make it interactive (and render it also in case of server mode) but will create an additional signalR circuit and won't work in case there are multiple components on the same page to render.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM