ejs-schedule 相关问题


req.query 似乎在不更改代码的情况下返回不同的值。我怎样才能让它稳定?

所以我尝试使用nodejs、express、ejs 和一个名为 ytdl-core 的 API 制作一个 Youtube 视频下载器。我遇到的问题是 有时 req.query 偶尔会返回 undefined 并且它......


下拉按钮在 Bootstrap 5.3 上不起作用

我正在使用 Express、EJS 和 bootstrap 制作一个网站,但下拉按钮不起作用 代码: <%- include('../includes/head') %> 我正在使用 Express、EJS 和 bootstrap 制作一个网站,但下拉按钮不起作用 代码: <%- include('../includes/head') %> <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">Dropdown button</button> <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li><a class="dropdown-item" href="#">Something else here</a></li> </ul> </div> <%- include('../includes/footer') %> 头: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> <title>Title</title> </head> <body> 页脚: <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> </body> </html> 当我单击按钮时,它不显示下拉菜单的内容 我不知道这是否重要/有效,但尝试将引导脚本从页脚移动到页眉,它可能基于加载顺序。


ng-bootstrap 滚动间谍在没有高度的情况下无法工作?

我在我的项目中使用 ng-bootstrap [ngbScrollSpy] 指令,如文档中所述,但它不起作用 - 滚动时活动项目不会改变。 我的代码如下: 我在我的项目中使用 ng-bootstrap [ngbScrollSpy] 指令,如文档中所述,但它不起作用 - 滚动时活动项目不会改变。 我的代码如下: <div> <div class="sticky-top"> <ul class="nav menu-sidebar"> <li > <a [ngbScrollSpyItem]="[spy, 'about']">About</a> </li> <li > <a [ngbScrollSpyItem]="spy" fragment="schedule">Schedule</a> </li> <li > <a [ngbScrollSpyItem]="spy" fragment="hotel">Information about the hotel</a> </li> </ul> </div> <div ngbScrollSpy #spy="ngbScrollSpy" > <section ngbScrollSpyFragment="about"> <h3>About</h3> <p>{{some long long text and content}}</p> </section> <section ngbScrollSpyFragment="schedule"> <h3>Schedule</h3> <p>{{some long long text and content}}</p> </section> <section ngbScrollSpyFragment="hotel"> <h3>Information about the hotel</h3> <p>{{some long long text and content}}</p> </section> </div> </div> 我在这个 stackoverflow 问题中看到,我的问题是我没有向我的 div 提供 height,这是事实。 但我的滚动间谍部分遍布整个页面,而不是一个小 div,(导航本身是 sticky-top)。所以我不能给它高度。 我知道有替代方法 - 刷新窗口滚动上的滚动间谍,但我没有找到可以帮助我的正确代码。 你能解决我的问题吗? 为我提供刷新滚动间谍的代码/给我有关高度的提示/帮助我找到另一个相应的元素。 非常感谢! 附上 stackblitz 演示的链接 注意:我使用来自 @ng-bootstrap/ng-bootstrap 的 NgbScrollSpy (我想它是非常相似的库) 我做什么: 我将所有内容(包括导航)包装在中 <div class="wrapper" ngbScrollSpy #spy="ngbScrollSpy" rootMargin="2px" [threshold]="1.0" > <div class="sticky-top pt-4 pb-4 bg-white"> ..here the navigation... </div> ..here the sections... <section ngbScrollSpyFragment="about"> </section> //the last I use margin-bottom:2rem; <section ngbScrollSpyFragment="hotel" style="margin-bottom:10rem" </section> </div> 见“门槛”。这表明“更改”活动片段应该可见的百分比(1 是 100%) 包装类 .wrapper{ height:100%; position: absolute; top:0; } 我使用强制链接的类别 //remove all the class for the link a{ color:black; text-decoration:none; padding:8px 16px; } a.custom-active{ color:white; background-color:royalblue } 以及我使用的每个链接 <a [class.custom-active]="spy.active=='about'">About</a> 嗯,问题是如何“滚动到”。 “链接”应该作为链接使用。 第一个是指示“路由器”应该考虑“碎片” 如果我们的组件是独立组件,我们需要使用提供者,provideRouter bootstrapApplication(App, { providers: [ provideRouter([], withInMemoryScrolling({anchorScrolling:'enabled'})), ] }) 然后,我们需要考虑到我们的页面确实没有滚动,div“包装器”是谁拥有滚动。因此,我们订阅 router.events,当事件有“锚点”时,我们滚动“包装器”div constructor(router: Router) { router.events.pipe(filter((e:any) => e.anchor)).subscribe((e: any) => { (document.getElementById('wrapper') as any).scrollTop+= (document.getElementById(e.anchor)?.getBoundingClientRect().top||0) -72; //<--this is the offset }); } 在这个stactblitz中你有一个有效的例子


访问 ExpandoObject 中的动态视图

我有以下方法来创建这个 ExpandoObject: List 示例 = new List(); foreach(费率中的变量率) { varrateObject = new ExpandoObject() as IDictionar... 我有以下方法来创建这个ExpandoObject: List<object> example = new List<object>(); foreach (var rate in rates) { var rateObject = new ExpandoObject() as IDictionary<string, object>; rateObject["Id"] = rate.Id; rateObject["RateType"] = rate.RateType; rateObject["Units"] = rate.R6Item.Unit.Symbol; rateObject["Schedule"] = rate.R6Item.Schedule.Description; rateObject["R6Code"] = rate.R6Item.Code; rateObject["R6Description"] = rate.R6Item.Description; rateObject["R7Code"] = rate.R7Item.Code; rateObject["R7Description"] = rate.R7Item.Description; rateObject["DICODE"] = rate.R6Item.Schedule.Discipline.Code; foreach (var currency in rate.Project.ProjectCurrencies) { rateObject[currency.Currency.Name] = currency.Currency.Name; } example.Add(rateObject); } 现在,当我展开示例对象时,它看起来像这样: 如果我进一步扩展,就像这样: 现在我想要的数据是如何在动态视图中显示的,有没有办法能够访问它?并有与 ExpandoObject 的动态视图相同的示例? 您肯定可以做很多事情来增强您的调试体验。这是我的快速尝试: 我必须使用组合来扩展密封类ExpandoObject,其属性为: class MyExpando { [DebuggerBrowsable(DebuggerBrowsableState.Never)] public ExpandoObject Value { get; } = new(); [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] public List<KeyValuePair<string, object?>> Properties => Value.ToList(); public void Add(string key, object value) => ((IDictionary<string, object?>)Value)[key] = value; public override string ToString() => string.Join(", ", Value.Select(o => $"{o.Key}={o.Value}")); } 有: 覆盖显示集合时使用的ToString()方法, 隐藏在调试器属性 Value 中以访问 ExpandoObject, 属性 Properties 用于在调试器 KeyValuePair 条目中可视化。


访问 Expando 对象内的动态视图

我有以下方法来创建这个expandoObject: List 示例 = new List(); foreach(费率中的变量率) { var 速率对象 = 新 我有以下方法来创建这个expandoObject: List<object> example = new List<object>(); foreach (var rate in rates) { var rateObject = new ExpandoObject() as IDictionary<string, object>; rateObject["Id"] = rate.Id; rateObject["RateType"] = rate.RateType; rateObject["Units"] = rate.R6Item.Unit.Symbol; rateObject["Schedule"] = rate.R6Item.Schedule.Description; rateObject["R6Code"] = rate.R6Item.Code; rateObject["R6Description"] = rate.R6Item.Description; rateObject["R7Code"] = rate.R7Item.Code; rateObject["R7Description"] = rate.R7Item.Description; rateObject["DICODE"] = rate.R6Item.Schedule.Discipline.Code; foreach (var currency in rate.Project.ProjectCurrencies) { rateObject[currency.Currency.Name] = currency.Currency.Name; } example.Add(rateObject); } 现在,当我展开示例对象时,它看起来像这样: 如果我进一步扩展,就像这样: 现在我想要的数据是如何在动态视图中显示的,有没有办法能够访问它?并有与 ExpandoObject 的动态视图相同的示例吗? 您肯定可以做很多事情来增强您的调试体验。这是我的快速尝试: 我必须使用组合来扩展密封类ExpandoObject,其属性为: class MyExpando { [DebuggerBrowsable(DebuggerBrowsableState.Never)] public ExpandoObject Value { get; } = new(); [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] public List<KeyValuePair<string, object?>> Properties => Value.ToList(); public void Add(string key, object value) => ((IDictionary<string, object?>)Value)[key] = value; public override string ToString() => string.Join(", ", Value.Select(o => $"{o.Key}={o.Value}")); } 有: 覆盖显示集合时使用的ToString()方法, 隐藏在调试器属性 Value 中以访问 ExpandoObject, 属性 Properties 用于在调试器 KeyValuePair 条目中可视化和编辑。


© www.soinside.com 2019 - 2024. All rights reserved.