React配置使用Bootstrap

1.安装Bootstrap依赖

npm install bootstrap@3 --save

2.在入口文件里(src下的index.js)导入Bootstrap依赖和css样式表

import 'bootstrap/dist/css/bootstrap.min.css';

import 'bootstrap/dist/js/bootstrap';

3.引入Jquery的在线依赖(public下的index.html)

<script type="text/javascript"src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>

4.使用

<form >
          <div className="form-group">
            <label >账号:</label>
            <input type="text" className="form-control" id="exampleInputEmail1" placeholder="输入账号"></input>
          </div>
          <div className="form-group">
            <label >密码:</label>
            <input type="password" className="form-control" id="exampleInputPassword1" placeholder="输入密码"></input>
          </div>
          <button type="submit" className="btn btn-info">登录</button>
          <button type="reset" className="btn btn-danger" >重置</button>
        </form>

注:onSubmit={this.getFrom.bind(this)} --表单提交事件

       onReset={this.resetFrom}  --表单重置事件

       e.preventDefault() || (e.returnValue = false); --阻止页面刷新

       this.props.history.replace('/Home') --事件跳转

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您,${username}!</h1> <p><a href="UserServlet?action=logout">退出登录</a></p要动态合并单元格,需要在渲染表格之前对表格数据进行处理,合并需要合并> </body> </html> ``` 6. 配置web.xml文件 在`web.xml`文件中配置Servlet和JSP的行或列,并将处理后的数据传递给 `react-bootstrap-table-next` 组件进行渲染。 下面是一个例页面的映射关系: ```xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="子,演示如何在渲染表格之前动态合并单元格: ```javascript import BootstrapTable from 'http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" react-bootstrap-table-next'; import 'react-bootstrap-table-next/dist/react-bootstrap-table2.min.css'; function mergeCells(data, mergeColumns) { xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web // 处理需要合并的列 const merged = []; let i = 0; while (i < data.length)-app_4_0.xsd" version="4.0"> <servlet> <servlet-name>UserServlet</s { const row = data[i]; let j = i + 1; while (j < data.length && mergeColumns.every((ervlet-name> <servlet-class>com.example.servlet.UserServlet</servlet-class> </servlet> <servlet-mcol) => data[j][col] === row[col])) { j++; } if (j - i > 1) { apping> <servlet-name>UserServlet</servlet-name> <url-pattern>/UserServlet</url-pattern> </servlet // 合并需要合并的行或列 const mergedRow = { ...row }; mergeColumns.forEach((col) =>-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web mergedRow[col] = { value: row[col], rowSpan: j - i }); merged.push(mergedRow); } else { -app> ``` 7. 运行项目 将项目部署到Tomcat服务器上,启动服务器后在浏览器中 // 不需要合并的行或列 merged.push(row); } i = j; } return merged; 访问`http://localhost:8080/`即可进入主页,点击“立即开始”按钮进入登录页面} const data = [ { id: 1, name: 'John', age: 30, gender: ',输入正确的用户名和密码后,进入欢迎页面,点击“退出登录”按钮即可注销用户。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值