bootstrap-dialog 相关问题


Next.js Shadcn 对话框组件出现水合错误

我在使用 Shadcn Dialog 组件时在 Next.js 项目中遇到水合错误。错误信息是: “水合失败,因为初始 UI 与渲染的内容不匹配......


防止 HTML <dialog> 用 Vue 关闭

我正在尝试使用 Vue 以编程方式阻止 HTML 对话框元素的关闭事件关闭对话框。这是我正在使用的代码: 从“vue”导入{ref}; const 对话框模板Re...


Bootstrap 5.2 下拉菜单在 Laravel 中不起作用

我已经从 Bootstrap 网站安装了预配置的导航栏之一。是Bootstrap 5.2的最新版本;但是,下拉菜单不起作用。我没有碰代码;这只是一个定义...


在 Rails 7 应用程序中使用 bootstrap javascript

我有一个正在运行的 Rails 7 应用程序,它使用 esbuild 作为 JS 捆绑器并导入了 bootstrap。 我正在尝试弄清楚如何访问主“外部”的任何 Bootstrap Javascript 功能


如何在 Rails 7 esbuild 应用程序中显示 Bootstrap 5.3 弹出窗口?

当我使用 Bootstrap 创建全新的 Rails 7 应用程序时,Modals 可以开箱即用,但 Popover 则不然。我如何让他们工作? Rails 7.1.2、esbuild、Bootstrap 5.3.2: Rails 新 -- 数据库 sqlite3 --


应用程序定制器和多个Web部件中的jquery和bootstrap

是个人选择使用bootstrap进行定制。因此,我计划在应用程序定制器和多个 Web 部件中使用 jQuery 和 Bootstrap。对此最好的方法是什么?我正在尝试...


如何确定 Bootstrap 5 Modal 按钮不起作用的原因?

我有一个基于 Django 的网站,使用 bootstrap 5。我有一个数据表和一个包含大量文本的注释列。我正在尝试使用 Bootstrap Modal 弹出功能来显示要保留的注释...


PHP 与 Bootstrap 轮播

我正在尝试学习 PHP 并将其与我的网站的 Bootstrap 库一起使用。我希望使用引导程序轮播,如此处所示 我想要实现的是带有标题的轮播和


带有 --css bootstrap 的 Rails 7 新应用程序 - Turbo 按钮不起作用

使用 Rails new myapp --css bootstrap 创建新应用程序 Rails 7 时,我的涡轮按钮将不起作用: =button_to“退出”,edit_post_path,方法::删除,形式:{数据:{turbo_confirm:“...


为什么我们不能使用CSS改变Bootstrap 4中徽章类的颜色?

Bootstrap v4.3.1 中徽章的类是 。徽章 { 显示:内联块; 填充:0.25em 0.4em; 字体大小:75%; 字体粗细:700; 行高:1; 文本对齐:居中; 白色-s...


Bootstrap 模式仅显示 MongoDB 集合中的第一条记录

我正在使用 NodeJS、Handlebars 和 Bootstrap 构建一个简单的 Web 应用程序。它应该循环遍历模拟产品的 MongoDB 集合并显示其字段。 我正在“产品...


Bootstrap 5使用js切换折叠不起作用

出于某种原因,我想在没有ID的情况下使用折叠。我在 stackoverflow 上找到了一个旧答案,它似乎在 Bootstrap 5 中不起作用。 错误:未捕获类型错误:c.nextElementSibling.collapse i...


Bootstrap 无法与 Rails 正确配合使用

大家好 我使用这个入门模板启动一个新的 Rails 应用程序,当我从 bootstrap 添加一个简单的导航栏时。 它看起来像这样 主要问题是JS不起作用,下拉菜单我...


如何在没有ID的情况下初始化和操作Bootstrap Collapse?

出于某种原因,我想在没有ID的情况下使用折叠。我在 stackoverflow 上找到了一个旧答案,它似乎在 Bootstrap 5 中不起作用。 错误:未捕获类型错误:c.nextElementSibling.collapse i...


为什么我在GWT中无法隐藏UiBinder中的DialogBox?

在 Test.ui.xml 中 测试 一些小部件.. 在Test.ui.xml <g:DialogBox ui:field="wishlistDialogBox" autoHide="true"> <g:caption>Test</g:caption> <g:HTMLPanel> some widgets..</g:HTMLPanel> </g:DialogBox> 运行后,应用程序仍然显示DialogBox,所以我尝试在TestView.java中为“wishlistDialogBox”设置隐藏,但没有成功。 @UiField DialogBox wishlistDialogBox; @Inject public TestView(final Binder binder) { widget = binder.createAndBindUi(this); wishlistDialogBox.hide(); } 然后我在TestPresenter.java中为它设置了隐藏,但仍然不起作用 @Override protected void onBind() { super.onBind(); getView().getWishlistDialogBox().hide(); } 怎么了,古德尔根本没有解释。 另外,DialogBox如何重复使用? 当谈论将它们添加到 DOM 时,DialogBox(以及一般的 PopupPanel)不像任何其他小部件那样工作。您永远不应该像以前那样将它们直接附加到它(即 panel.add(yourDialogBox) 或在 UiBinder XML 文件中)。相反,您应该创建它们,然后简单地调用 hide()/show() 以及类似的方法,以使其显示/隐藏(即,在 DOM 的末尾附加/分离)。 对我有用的是与任何其他小部件分开创建一个对话框。所以它有自己的 Java 文件和自己的 ui.xml 文件: UiBinder xml文件: <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"> <g:DialogBox ui:field="dialog"> <g:caption>My Dialog</g:caption> <g:HTMLPanel> <g:Button ui:field="closeButton" text="close" /> </g:HTMLPanel> </g:DialogBox> </ui:UiBinder> Java 文件: public class MyDialog { // here you do not inherit anything private static MyDialogUiBinder uiBinder = GWT.create(MyDialogUiBinder.class); interface MyDialogUiBinder extends UiBinder<Widget, MyDialog> { } @UiField DialogBox dialog; @UiField Button closeButton; public MyDialog() { // make cast to DialogBox dialog = (DialogBox) (uiBinder.createAndBindUi(this)); } public void hide() { dialog.hide(); } public void show() { dialog.center(); } @UiHandler("closeButton") public void onClick(ClickEvent event) { hide(); } } 最后我想出了一个办法,那就是把DialogBox放到一个看不见的HTMLPanel <g:HTMLPanel visible="false"> <g:DialogBox ui:field="wishlistDialogBox" autoHide="true"> <g:caption>Test</g:caption> <g:HTMLPanel> some widgets..</g:HTMLPanel> </g:DialogBox> </g:HTMLPanel> 然后像往常一样调用 show & hide DialogBox,即使 DialogBox 被包裹在一个看不见的 DialogBox 中,它也会显示 HTMLPanel。 getView().getWishlistDialogBox().show();


Bootstrap CSS - 将页面从中心向下拆分。用图像填充左侧,用文本填充右侧

我对 bootstrap 5 相当熟悉,但我正在开发一个项目,我试图找出将页面从中心拆分的最佳方法,但中间还有一个容器,允许.. .


如何用html和bootstrap保证屏幕宽度内自动换行

我正在 Flask、Mongodb、HTML 和 Bootstrap 上制作一个 Web 应用程序。我的问题是表格列中的单词会从屏幕上消失,我需要滚动浏览器窗口才能阅读它们。 可以请你...


如何让 Reactstrap 响应式?

我刚开始使用reactstrap(不是react-bootstrap),并且正在尝试如何渲染“移动”和“桌面”视图。 我如何让reactstrap渲染页面...


引导日期时间选择器无法运行

我正在尝试优秀的 Bootstrap DateTimePicker 插件,但似乎一开始就遇到了缓冲区。页面控件显示正确,但日历按钮完全


如何在 ASP.NET MVC 4 中为 CSP 使用动态随机数

我在 ASP.NET MVC 4 中开发了 MVC 应用程序。我在几个页面中使用了 javascript。一些 javascript 被引用为 @Scripts.Render(“~/Scripts/bootstrap”) @Scripts.Render("~/Sc...


在添加新行时刷新 html 可编辑表格 - Bootstable

我使用 boostable 插件在运行时内联编辑 HTML 行。该插件位于 https://www.jqueryscript.net/table/Editable-Tables-jQuery-Bootstrap-Bootstable.html。问题是现在当我想要的时候


如何在 Laravel 中添加外部 scss 文件?

我从Colorlib购买了一个主题,Bootstrap Sidebar V02,包含SCSS文件。将这个外部 SCSS 文件添加到 Laravel 项目的相关方法是什么? mix.sass('资源/sass/样式。


如何配置验证以对无效输入使用“is-invalid”类

默认情况下,ASP.NET Core 中的输入验证使用类 input-validation-error,但 Bootstrap 5 使用 is-invalid。 我找到了一些解决方案: 创建样式 使用 jQuery.validate.unobtrusi...


Laravel 线元素包 - 如何将其与 bootstrap 主题一起使用?

有这个包https://github.com/wire-elements/modal。 我已按照配置步骤来实现模式,但是我使用了不同的 CSS 框架。我的问题是哪里说:


Blazor 内联渲染怪异

我正在使用 Blazor Bootstrap 并尝试在提交表单后更新页面。该表单只是创建一个数据库条目并返回 true 或 false。该页面正在使用禁用的选项卡...


BS 导航栏不适用于下载的 Bootstrap 库。 CDN 没问题,请帮助我

我正在尝试使用带有下载的库/离线的引导程序。 然而,编写的 html 与 CDN 配合得很好。 这是文件夹架构。 ...


Bootstrap 手风琴边框顶部不是第一项

我在 Angular 应用程序中使用引导手风琴,我希望周围的每个人都有一个带颜色的边框。通过标准引导程序,如果手风琴不是...


Angular 中的 JavaScript 函数“未定义”错误

我正在尝试让 Angular 17 项目正常运行。我正在使用 Bootstrap (5),并尝试让 datePicker 工作。这需要一些 JavaScript 代码,但我无法使用这些代码。我已经关注了...


当需要删除浮动标签效果时也删除

有没有一种方法可以用于 bootstrap 4 上的浮动标签,当我删除输入上所需的标签时,标签保留在边框的顶部。 $(文档).ready(函数() { $('.form-g...


鼠标悬停时停止 setTimeout 引导模式

我使用 Bootstrap 4 创建模态,并在后端添加 settimeout 以在 X 秒后关闭模态。 但如果用户没有读完该模式,这就是我的主要目标:我想停止设置...


引导模式在单击按钮时不显示内容(Django 框架)

我在 HTML 代码中遇到了 Bootstrap 模式的问题,当我单击触发它们的按钮时,它们没有显示任何内容。尽管 ID 和属性看似正确,但


Bootstrap - 如何创建具有可滚动列的全屏布局?

我正在尝试创建一个全屏布局,占据 100% 的视口,并带有粘性页眉和页脚,以及主内容区域中可单独滚动的列。 我已经和你一起实验过...


Bootstrap 5:使输入文件与其他字段具有相同的高度

我正在使用这个简单的模板来显示带有文件附件字段的注册表单: /* 当我尝试修改自己的高度时,问题就出现了 */ .mycustom{ 行高:2.75; z...


从中心向下拆分页面。用图像填充左侧,用文本填充右侧

我对 bootstrap 5 相当熟悉,但我正在开发一个项目,我试图找出将页面从中心拆分的最佳方法,但中间还有一个允许的容器。 ..


如何在 Bootstrap 5 中保持一项手风琴项目始终打开?

我默认打开了第一个手风琴项目,所以我想做的就是随时至少打开一个(因此侧面的图片保持合适的纵横比)。默认情况下我可以


在 Angular 和 Bootstrap 中,当鼠标悬停在导航项上时,如何单击展开的下拉列表中的按钮?

当前行为:将鼠标悬停在导航项上时,下拉容器变得可见,但无法单击容器内的按钮。 预期行为:悬停在...上时


脚本无法在我的引导模式中工作

希望这不是一个愚蠢的问题,但我已经没有主意了...... 所以我有这个模式: 1.scala.html 希望这不是一个愚蠢的问题,但我已经没有主意了...... 所以我有这个模式: 1.scala.html <div class="feat" id="cor" data-toggle="tooltip" data-placement="bottom" title="add conference role"><div data-toggle="modal" data-target="#conf-role-menu-modal">Conference Role</div></div> <div class="modal fade" id="conf-role-menu-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="myModalLabel">Modal title</h4> </div> <div class="modal-body-conf-role-menu"> <script type="text/javascript"> $(function(){ $(".modal-body-conf-role-menu").load("@routes.Application.areaConferenceRole(id,idenv)"); }); </script> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> 使用模态主体中的脚本,我尝试加载此页面: 2.scala.html @(id:String, idenv:String) @Main("Add area") { <form action="@routes.Application.areaPostConferenceRole(id,idenv)" method="POST"> First Name: <input type="text" name="first_name" id="first" class="form-control"> Last Name : <input name="last_name" class="form-control"> <script type="text/javascript"> $( document ).ready(function() { // Handler for .ready() called. $( "#first" ).focus(function() { alert( "Handler for .focus() called." ); }); }); </script> </form> } 页面加载正常。我在我的模态中看到它...... 问题是我的页面 2.scala.html 中的脚本无法运行。我不明白为什么......如果我从我尝试在模态中加载的页面之外尝试它们,它们就会起作用...... $( document ).ready(function(){}); 永远不会在模态中到达,因为加载页面时已经触发了此事件(模态在之后加载...) 尝试直接插入脚本,如下所示: <script type="text/javascript"> $( "#first" ).focus(function() { alert( "Handler for .focus() called." ); }); </script> 当引导模式弹出时,shown.bs.modal事件将被触发。这是例子。 $('#myModal').on('shown.bs.modal', function () { $('#myInput').trigger('focus') }) Full documentation. https://getbootstrap.com/docs/4.0/components/modal/ 试试这个我已经准备好这个功能了 $('#myModal').on('shown.bs.modal', function () { // Your script here }); $(document).on('shown.bs.modal', '#myModal', function () { // Your script here });


如何在flex-grow容器中创建响应式表格而不影响整体布局?

我正在使用 Bootstrap 5.3 开发响应式布局,其中包括导航栏、侧栏、内容面板和状态栏。该应用程序应始终为 100% 视图高度和视图宽度,并包含所有信息...


下拉按钮在 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> 当我单击按钮时,它不显示下拉菜单的内容 我不知道这是否重要/有效,但尝试将引导脚本从页脚移动到页眉,它可能基于加载顺序。


在 Angular 17 独立模式下,如何使用 Swiper 版本 11.0.5 使 Bootstrap 下拉列表在 Swiper 元素外部可见

在下面的刷卡器代码中,如何使引导下拉列表在刷卡器容器外部可见。我不想自动调整滑动器容器的高度。我希望我的容器有固定的高度......


如何在我的 Blazor 服务器 razor 页面中使用 JavaScript;提交表单时更改 blazor bootstrap 按钮的样式

我的项目是 Blazor 服务器应用程序。我想要实现的功能是,如果我的验证失败(如果我的输入中没有任何内容),我希望我的手风琴标题更改为红色......


我如何根据状态更改按钮颜色(绿色表示“接受”,红色表示“删除”)

如何根据状态更改按钮颜色(绿色表示“接受”,红色表示“删除”) 我是新人,为此使用 Laravel 框架。 这是我的观点 如何根据状态更改按钮颜色(绿色表示“接受”,红色表示“删除”) 我是新人,为此使用 Laravel 框架。 这是我的看法 <table class="table table-striped" id="example"> <thead> <tr> <th>ID no</th> <th>Form Name</th> <th style="text-align: center">Update</th> <th>Delete</th> <th>Status</th> </tr> </thead> @foreach($form as $show) {{--modal--}} <div class="modal fade mj_popupdesign mj_checkoutpopup" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-body"> <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12 col-lg-offset-2 col-md-offset-2"> <div class="row"> <div class="mj_pricingtable mj_greentable mj_login_form_wrapper"> <form> <div class="mj_login_form"> <p>Are you sure you want to delete this post?</p> <br> <a href="" class="mj_btn btn btn-default pull-right glyphicon glyphicon-remove "> No</a> <a href="{{url('deleteForm',$show->id)}}" class=" pull-right mj_btn btn btn-danger glyphicon glyphicon-ok"> Yes</a> </div> </form> </div> </div> </div> </div> </div> </div> </div> {{--end modal--}} <tbody> <tr> <td> <p> {{$show->id}}</p> </td> <td> <h6><a href="{{url('JobDetails',$show->id)}}"style="color: rgb(0, 191, 243);font-size:18px;float: left;margin: 0;text-align: left">{{$show->jobTitle}}</a> </h6> <p> {{$show->created_at}} </p> </td> <td> <a href="{{url('UpdateFormView',$show->id)}}"> <span class="mj_btn btn btn-success">Update</span> </a> </td> <td> <span class="mj_btn btn btn-danger" data-toggle="modal" data-target="#myModal2">Delete</span> </td> <td><span class="mj_btn btn btn-warning">pending</span> </td> </tr> </tbody> @endforeach </table> </div> </div> </div> </div> 在我的控制器中public function AcquiredForm() { $acquired="Requirement Form"; $acquireForm=Job::where('jobType','LIKE','%'.$acquired.'%'); $form = $acquireForm->get(); return view('private-pages.company.aquire-form',compact('form')); } 数据库状态默认为待处理 数据库状态默认为pending 我在代码中没有看到 status 属性,但显示状态为待处理的纯字符串 <span class="mj_btn btn btn-warning">pending</span> <!-- while it suppose to be --> <span class="mj_btn btn btn-warning">{{ $show->status }}</span> 假设它确实存在,你可以做 <td> @if ($show->status === 'Accept') <span class="mj_btn btn btn-green">Accepted</span> @elseif ($show->status === 'Delete') <span class="mj_btn btn btn-danger">Deleted</span> @else <span class="mj_btn btn btn-warning">Pending</span> @endif </td> 参见:https://laravel.com/docs/5.1/blade#displaying-data <td> @if ($show->jobstatus === "Accepted") <span class="mj_btn btn btn-success">Accepted</span> @elseif ($show->jobstatus === "Rejected") <span class="mj_btn btn btn-danger">Rejected</span> @else <span class="mj_btn btn btn-warning">Pending</span> @endif </td> 或者当你使用 1. laravel esialy customaize this code nad add automatic refresh in the page to more interactive @php if($da->status == "requested") { echo "<td><button class='btn btn-primary'>Requested</button></td>"; } else { echo "<td><button class='btn btn-success'>Ordered</button></td>"; } @endphp


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中你有一个有效的例子


如何防止我的CSS规则被reactjs/jsx中的规范化CSS覆盖?

我有一个非常简单的反应组件 类 UpgradeContainer 扩展组件 { 使成为() { 返回 ( 我有一个非常简单的反应组件 class UpgradeContainer extends Component { render() { return ( <div className={styles.msg}> <div className={styles['msg-container']}> <h3 className={`${styles.title} highlight-color`}> Big Header </h3> <div className={`${styles.description} alternate-color`}> Small text <br /> Some more small text </div> </div> </div> ); } 这是相关的css .title { font-size: 40px; line-height: 50px; color: white; } .description { text-align: center; font-size: 16px; padding: 20px 0 10px; color: white; } 这是上面组件的 DOM 输出 此处以文本形式转载: <div class="mRMOZryRtlFUx_NHlt1WD" data-reactid=".0.1.0.0.0.1"> <h3 class="_2s6iXRZlq-nQwIsDADWnwU highlight-color" data-reactid=".0.1.0.0.0.1.0"> Big Header</h3> <div class="_1pFak-xR0a8YH6UtvoeloF alternate-color" data-reactid=".0.1.0.0.0.1.1"> <span data-reactid=".0.1.0.0.0.1.1.0">Small text</span> <br data-reactid=".0.1.0.0.0.1.1.1"> <span data-reactid=".0.1.0.0.0.1.1.2">Some more small text</span></div></div> 如你所见,reactjs 添加了几个 <span/> 来包裹小文本 我希望标题文本 (Big Header) 比描述文本(small text 和 some more small text)大得多。 输出看起来像这样: 这是因为reactjs出于某种原因添加了一个span来包裹文本small text和some more small text(data-reactid“.0.1.0.0.0.1.1.0”和“.0.1.0.0.0.1.1.2”分别) 当我检查样式时,我发现这些 span 元素的样式被以下 css 规则覆盖 我真的很困惑,因为这些规则不是我自己定义的。 所以我点击 <style>...</style>,它会将我带到 我想知道如何有效地覆盖这些CSS规则? 我想要的最终结果是: 如果您使用“Normalize.css”! 此问题的解决方案是将主 css 文件“style.css”保留在底部。至少低于normalize.css。 如果您使用 Bootstrap, 直接来自 Bootstrap 官方网站,“为了改进跨浏览器渲染,我们使用 Normalize.css,这是 Nicolas Gallagher 和 Jonathan Neal 的一个项目。” 这个问题的解决方案是将主 css 文件“style.css”保留在底部。至少低于 bootstrap.css。 我遇到了与您类似的问题,我的解决方案是在 app.tsx 文件顶部导入 Bootstrap 样式。这样做的原因是它可以防止 Bootstrap CSS 被应用程序中的其他样式覆盖,它对我有用


引导进度条没有进度

引导进度条在我的 MVC 索引视图上不起作用。 我已经用 Chrome 和 Internet Explorer 尝试过了。 @{ ViewBag.Title = "首页"; } 引导进度条在我的 MVC 索引视图上不起作用。 我已经用 Chrome 和 Internet Explorer 尝试过了。 @{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-large">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <div class="progress-bar progress-striped "></div> </div> </div> 本次聚会迟到了,但在我使用的 Bootstrap 版本(v3.1.1)中,该类是“progress-striped”(不是像文档所说的“progress-bar-striped”),并且它和“active” ' 类必须应用于外部 div: <div class="progress progress-striped active"> <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">Some text</div> </div> 查看 CSS,选择器“progress-bar”已更改为“bar”: ./bootstrap.css: .progress { ... } .progress .bar { ... } 因此,将您的代码更改为 <div class="progress"> <div class="bar"> </div> </div> 然后就可以了。 不确定这种疯狂的原因是什么,似乎引导文档还没有更新。 <div class="progress"> <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div> </div> 这样进度动画就可以工作了。 <div class="progress"> <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;"> <span class="sr-only">60% Complete</span> </div> </div> 上面是 bootstrap v3.1.1 的代码,看起来你的进度条 div 缺少一些元素? 如果您使用 Bootstrap v4 并且需要动画,则需要使用 progress-bar-animated 而不是 active。


如何捕获 React-Bootstrap 下拉列表的值?

我弄清楚了如何使用react-bootstrap来显示下拉列表: 我想出了如何使用react-bootstrap来显示下拉列表: <DropdownButton bsStyle="success" title="Choose" onSelect={this.handleSelect} > <MenuItem key="1">Action</MenuItem> <MenuItem key="2">Another action</MenuItem> <MenuItem key="3">Something else here</MenuItem> </DropdownButton> 但是我该如何编写 onSelect 的处理程序来捕获正在选择的选项呢?我尝试了这个,但不知道里面写什么: handleSelect: function () { // what am I suppose to write in there to get the value? }, 还有,有没有办法设置默认选择的选项? onSelect函数传递所选值 <DropdownButton title='Dropdowna' onSelect={function(evt){console.log(evt)}}> <MenuItem eventKey='abc'>Dropdown link</MenuItem> <MenuItem eventKey={['a', 'b']}>Dropdown link</MenuItem> </DropdownButton> 在这种情况下,如果您选择第一个选项,则会打印“abc”,在第二个选项中您可以看到也可以传入一个对象。 所以在你的代码中 handleSelect: function (evt) { // what am I suppose to write in there to get the value? console.log(evt) }, 我不确定默认值是什么意思,因为这不是一个选择 - 按钮文本是标题属性中的任何内容。如果你想处理默认值,你可以在值为 null 时设置一个值。 您忘记提及 eventKey 作为第二个参数传递,这是获取您单击的值的正确形式: handleSelect: function (evt,evtKey) { // what am I suppose to write in there to get the value? console.log(evtKey) }, 您可能需要针对您的情况使用 FormControl >> 选择组件: <FormControl componentClass="select" placeholder="select"> <option value="select">select</option> <option value="other">...</option> </FormControl> 您应该按如下方式更改handleSelect签名(在组件类中): handleSelect = (evtKey, evt) => { // Get the selectedIndex in the evtKey variable } 要设置默认值,您需要使用 title 上的 DropdownButton 属性 参考:https://react-bootstrap.github.io/components/dropdowns/


如何使用 Bootstrap 5 禁用自定义范围而不更改样式?

我有范围: 我有范围: <!DOCTYPE html> <html lang="en"> <head> <!-- Bootstrap --> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" /> </head> <body> <div class="container mb-4 col-sm-5"> <input type="range" class="custom-range" min="0" max="10" value="10" id="range-input" style="width: 100%"> </div> </body> </html> 我想禁用它(它应该仍然看起来一样,但用户不能再与它交互),但是不改变样式。例如: 图中,顶部的启用,底部的禁用;我想禁用它,同时保持顶级范围的样式。 我尝试手动重新创建原始样式,但没有成功: <!DOCTYPE html> <html lang="en"> <head> <!-- Bootstrap --> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" /> <style> input[type=range]:disabled { background-color: blue; color: blue; background: blue; } </style> </head> <body> <div class="container mb-4 col-sm-5"> <input type="range" class="custom-range" min="0" max="10" value="10" id="range-input" style="width: 100%" disabled> </div> </body> </html> 除此之外,我在研究中找不到任何其他可能的解决方案。 您实际上需要“如何”禁用它? 设置 pointer-events: none 并添加 tabindex="-1",你会得到一个看起来仍然相同的元素,但用户无法再与之交互(至少通过鼠标单击/点击,并且他们无法通过键盘将其聚焦)控制其中之一 - 不确定是否还有其他什么?) 由于没有设置 name 属性,该字段不会成为表单提交数据集的一部分 - 如果在您的实际用例中有所不同,您也可以删除(并重新设置)名称,当您可以打开和关闭 tabindex。


ClosedXML 导出数据网格到 Excel 仅 10 行

我有一个包含 60 行数据的数据网格和一个将其导入 Excel 的按钮: 我有一个包含 60 行数据的数据网格和一个将其导入 Excel 的按钮: <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Source}" CanUserAddRows="False" HeadersVisibility="All" Name="dgDisplay"> <DataGrid.Columns> <DataGridTextColumn Header="Day" Binding="{Binding Day}"/> <DataGridTextColumn Header="Data" Binding="{Binding Data}"/> </DataGrid.Columns> </DataGrid> <Button Command="{Binding SaveDataGridToExcelCommand}" CommandParameter="{Binding ElementName=dgDisplay}"/> 其中 Day 和 Data 只是一些随机生成的 int 数据。 我的代码使用 ClosedXML 将数据从中导出到 Excel,它使用 MainWindowViewModel: ObservableObject 调用 MVVM.Toolkit。 [RelayCommand] public void SaveDataGridToExcel(DataGrid dataGrid) { DataTable dt = new DataTable(); foreach (DataGridColumn column in dataGrid.Columns) { dt.Columns.Add(column.Header.ToString()); } foreach (var item in dataGrid.Items) { DataRow dr = dt.NewRow(); bool rowHasData = false; for (int i = 0; i < dataGrid.Columns.Count; i++) { var cellContent = dataGrid.Columns[i].GetCellContent(item); if (cellContent is TextBlock textBlock) { //check if row empty, dont add this row.I add it on purpose to check //if the datagrid recognite the rest 50 rows not have data. It actually //dont save those data dr[i] = textBlock.Text; if (!string.IsNullOrEmpty(textBlock.Text)) { rowHasData = true; } } } if (rowHasData) { dt.Rows.Add(dr); } } SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Excel files (*.xlsx)|*.xlsx"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { using (XLWorkbook wb = new XLWorkbook()) { wb.Worksheets.Add(dt, "Sheet1"); wb.SaveAs(saveFileDialog.FileName); } } } 但是保存的60行结果只显示了10行数据,其余50行都是空的。如果疑问为什么不使用Microsoft.Interop.Excel,那是因为该包不适合我的 Excel 版本。我没有在 ClosedXML 中看到任何对此有限制或许可的地方,所以我想知道为什么。如有任何帮助,我们将不胜感激。 在浏览 github 几个小时后,我自己找到了答案。 我没有访问单元格内容,而是直接从 DataGrid 的 ItemsSource 访问数据: public void SaveDataGridToExcel(DataGrid dataGrid) { DataTable dataTable = new DataTable(); foreach (DataGridColumn column in dataGrid.Columns) { dataTable.Columns.Add(column.Header.ToString()); } var itemsSource = dataGrid.ItemsSource as IEnumerable; if (itemsSource != null) { foreach (var item in itemsSource) { var properties = item.GetType().GetProperties(); var row = dataTable.NewRow(); foreach (var property in properties) { row[property.Name] = property.GetValue(item); } dataTable.Rows.Add(row); } } //show dialog... }


何时切换搜索栏和徽标下降?

.navbar { 背景颜色:#F91F46; } .src-bar { 边框:0; 边框半径:5px; 概要:无; 左内边距:15px; 宽度:30vw; } .navbar { background-color: #F91F46; } .src-bar { border: 0; border-radius: 5px; outline: none; padding-left: 15px; width: 30vw; } <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" integrity="sha512-b2QcS5SsA8tZodcDtGRELiGv5SaKSk1vDHDaQRda0htPYWZ6046lr3kJ5bAAQdpV2mmA/4v0wQF9MyU6/pDIAg==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/js/bootstrap.min.js" integrity="sha512-WW8/jxkELe2CAiE4LvQfwm1rajOS8PHasCCx+knHG0gBHt8EXxS6T6tJRTGuDQVnluuAvMxWF4j8SNFDKceLFg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <nav class="navbar navbar-expand-md fixed-top"> <div class="container-fluid"> <a class="navbar-brand ms-3" href="#"> <img src="img/Logo.avif" width="40px" class="d-inline-block" /> </a> <form role="search" class="search-bar"> <div class="input-group"> <input class="src-bar" type="search" placeholder="Search For Products" /> <button class="btn bg-white" type="submit"> <i class="fa fa-search"></i> </button> </div> </form> <div class="justify-content-end"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#nav-colps" aria-controls="nav-colps" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="nav-colps"> <ul class="navbar-nav me-auto mb-2 mb-lg-0"> <li class="nav-item"> <a class="nav-link active" aria-current="page" href="#">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Link</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Dropdown </a> <ul class="dropdown-menu" aria-labelledby="navbarDropdown"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li> <hr class="dropdown-divider" /> </li> <li><a class="dropdown-item" href="#">Something else here</a></li> </ul> </li> <li class="nav-item"> <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> </li> </ul> </div> </div> </div> </nav> 切换时,我希望折叠 div 居中。我知道原因 - 我将折叠和切换 btn 放在 justify-end div 内,因为我需要切换 btn 位置位于右侧。现在,当切换时,我的折叠位于右侧,但我希望在切换时,折叠div到中心。 当我删除 justify-end div 时,它位于左侧,但如果删除它,每个导航元素都会移动到 nav 和 md 视图中 lg 的左侧。 看起来像这样或中心 我们确实需要将 .nav-collapse 移到 justify-end 元素之外,才能在较窄的视口上获得所需的布局。 要将菜单显示在右侧,请通过 flex-grow: 1 类将 .nav-collapse 应用于 flex-grow: 0 元素,覆盖 flex-grow-0 上的默认 .nav-collapse。 为了使窄视口的链接元素居中,.navbar-nav中的元素采用垂直柔性布局,因此我们可以通过align-items: center类应用align-items-center: .navbar { background-color: #F91F46; } .src-bar { border: 0; border-radius: 5px; outline: none; padding-left: 15px; width: 30vw; } <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" integrity="sha512-b2QcS5SsA8tZodcDtGRELiGv5SaKSk1vDHDaQRda0htPYWZ6046lr3kJ5bAAQdpV2mmA/4v0wQF9MyU6/pDIAg==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/js/bootstrap.min.js" integrity="sha512-WW8/jxkELe2CAiE4LvQfwm1rajOS8PHasCCx+knHG0gBHt8EXxS6T6tJRTGuDQVnluuAvMxWF4j8SNFDKceLFg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <nav class="navbar navbar-expand-md fixed-top"> <div class="container-fluid"> <a class="navbar-brand ms-3" href="#"> <img src="https://picsum.photos/40/40" width="40px" class="d-inline-block" /> </a> <form role="search" class="search-bar"> <div class="input-group"> <input class="src-bar" type="search" placeholder="Search For Products" /> <button class="btn bg-white" type="submit"> <i class="fa fa-search"></i> </button> </div> </form> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#nav-colps" aria-controls="nav-colps" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse flex-grow-0" id="nav-colps"> <ul class="navbar-nav me-auto mb-2 mb-lg-0 align-items-center"> <li class="nav-item"> <a class="nav-link active" aria-current="page" href="#">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Link</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Dropdown </a> <ul class="dropdown-menu" aria-labelledby="navbarDropdown"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li> <hr class="dropdown-divider" /> </li> <li><a class="dropdown-item" href="#">Something else here</a></li> </ul> </li> <li class="nav-item"> <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> </li> </ul> </div> </div> </nav> 您还可以考虑通过 text-align: center 类应用 text-center,将链接元素 text 居中: .navbar { background-color: #F91F46; } .src-bar { border: 0; border-radius: 5px; outline: none; padding-left: 15px; width: 30vw; } <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" integrity="sha512-b2QcS5SsA8tZodcDtGRELiGv5SaKSk1vDHDaQRda0htPYWZ6046lr3kJ5bAAQdpV2mmA/4v0wQF9MyU6/pDIAg==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/js/bootstrap.min.js" integrity="sha512-WW8/jxkELe2CAiE4LvQfwm1rajOS8PHasCCx+knHG0gBHt8EXxS6T6tJRTGuDQVnluuAvMxWF4j8SNFDKceLFg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <nav class="navbar navbar-expand-md fixed-top"> <div class="container-fluid"> <a class="navbar-brand ms-3" href="#"> <img src="https://picsum.photos/40/40" width="40px" class="d-inline-block" /> </a> <form role="search" class="search-bar"> <div class="input-group"> <input class="src-bar" type="search" placeholder="Search For Products" /> <button class="btn bg-white" type="submit"> <i class="fa fa-search"></i> </button> </div> </form> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#nav-colps" aria-controls="nav-colps" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse flex-grow-0" id="nav-colps"> <ul class="navbar-nav me-auto mb-2 mb-lg-0 text-center"> <li class="nav-item"> <a class="nav-link active" aria-current="page" href="#">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Link</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Dropdown </a> <ul class="dropdown-menu" aria-labelledby="navbarDropdown"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li> <hr class="dropdown-divider" /> </li> <li><a class="dropdown-item" href="#">Something else here</a></li> </ul> </li> <li class="nav-item"> <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> </li> </ul> </div> </div> </nav>


NG8001:“app-welcome”不是已知元素:

我的 Angular 应用程序遇到问题,收到错误 8001。我不知道如何处理它。谁能帮我这个?谢谢你! 应用程序组件.html {{标题}}&l... 我的 Angular 应用程序遇到问题,收到错误 8001。我不知道如何处理它。谁能帮我这个?谢谢! app.component.html <h1>{{ title }}</h1> <p>Congratulations! Your app is running. 🎉</p> <app-welcome></app-welcome> app.component.ts import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterOutlet } from '@angular/router'; @Component({ selector: 'app-root', standalone: true, imports: [CommonModule, RouterOutlet], templateUrl: './app.component.html', styleUrl: './app.component.css' }) export class AppComponent { title = 'XYZCARS'; } welcome.component.ts import { Component } from '@angular/core'; @Component({ selector: 'app-welcome', templateUrl: './welcome.component.html', styleUrl: './welcome.component.css' }) export class WelcomeComponent { car = 'toyota'; } 我的项目最初没有 app.module.ts 文件。我自己添加了它并根据网上找到的一些信息进行了配置,但问题仍然存在并且仍未解决。谁能帮我解决这个问题吗? app.module.ts import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { WelcomeComponent } from './welcome/welcome.component'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent, WelcomeComponent ], imports: [ BrowserModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } 如果您正在 Angular 17 中创建项目->使用这些命令 ng app --no-standalone 然后你就得到了 app.module.ts 文件。


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