我在themeforest上买了Vuexy模板。然后,我将html功能添加到建立在Blazor系统上的网站上。
现在这些功能运行良好,只有导航菜单没有按我所希望的方式工作。
根据我购买的html模板
这是我添加Blazor后的图像
如您所见,浏览器会出现错误。
app-menu.js:82 Uncaught TypeError: Cannot read property 'stop' of null
at app-menu.js:82
setTimeout(function () {
$.app.menu.container.stop().animate(
{
scrollTop: change
},
300
);
$('.main-menu').data('scroll-to-active', 'false');
}, 300);
}我试过很多种方法,但都解决不了。希望你们都能帮我
发布于 2022-02-19 00:11:21
解决办法..。
MainLayout.razor
@code
{
[Inject]
protected IJSRuntime JsRuntime { get; set; }
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
JsRuntime.InvokeVoidAsync("onBlazorReady");
}
}index.html
<script>
var compactMenu = false;
var onBlazorReady = () => {
if (feather) {
feather.replace({
width: 14,
height: 14
});
}
if ($body.hasClass('menu-collapsed') || localStorage.getItem('menuCollapsed') === 'true') {
compactMenu = true;
}
$.app.menu.init(compactMenu);
$.app.nav.init({ speed: 300 });
}
</script>我不知道为什么。但这就是它的工作原理。
https://stackoverflow.com/questions/67685017
复制相似问题