简体   繁体   English

Blazor 仅在需要的组件中加载 JavaScript<script>

[英]Blazor load JavaScript just in Component that require <script>

I want to implement an external (Google Maps) and it is only required in two Pages of the Blazor Server Side Application.我想实现一个外部(谷歌地图),它只需要在 Blazor 服务器端应用程序的两个页面中。

So my question is if it is possible to just load the in this Pages and not directly in _Hosts File.所以我的问题是是否可以只在这个页面中加载而不是直接在 _Hosts 文件中加载。 If yes how can I achieve this?如果是,我怎样才能做到这一点?

Yes, it is possible in .Net 5.0 Read here是的,可以在 .Net 5.0 中阅读这里

See this for an introduction and code samples请参阅介绍和代码示例

See this answer看到这个答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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