作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有一个 react 组件。需要在页面加载时打开引导模式。尝试使用 jQuery 和简单的 JavaScript,但没有成功。
react 组件:
import React, { Component } from 'react'
import $ from 'jquery'
class Login extends Component {
componentDidMount() {
// here I want to open modal
}
render() {
return (
<div className="modal fade WelcomeModal" id="WelcomeModal" tabIndex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div className="modal-dialog modal-dialog-centered" role="document">
<div className="modal-content">
<div className="modal-header">
<div className="camera-box">
<img alt="" src="/img/yellow-logo.svg"/>
<h5 className="modal-title" id="exampleModalLabel">Welcome to the Cozy App!</h5>
</div>
</div>
<div className="modal-body">
<p className="text-center">On the following screens weʼll ask you to register the Cozys in your home & adjust your temperature settings. Youʼll need the following information:</p>
</div>
</div>
</div>
</div>
)
}
}
最佳答案
看看这个 codepen它展示了如何在不需要 jQuery 的情况下将 Bootstrap 类与 React 结合起来
toggleModal = () => this.setState({
showLogin: !this.state.showLogin
})
关于javascript - 如何在 react 组件中打开引导模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52753250/
我是一名优秀的程序员,十分优秀!