javascript - 模态不打开反应js
问题描述
我有一个打开我的模式的功能,该功能基于我传递给我的 Body 组件的道具功能激活,该功能改变了我的主类 App 中的状态,当我单击我放置在切换菜单中的锚点时,它会打开模式但是我正在尝试制作一个自动运行代码的演示。演示功能在我的 Body 组件中 当我运行演示功能时,它会打开菜单但不会打开我的笔记模式。
该函数在从演示运行时也会输出正确的值,只是不会弹出模态框。
//I have the following state:
this.state={
showNotes: false
//this function changes the state
openNotes = () =>{
console.log("opening notes")
this.setState({showNotes:!this.state.showNotes})
}
//I pass this function as a prop to my body component
<Route path="/app" render ={props=><Body {...props} openNotes={this.openNotes} />}/>
//inside body I use this function to create a demo of everything in the app.
rundemo=()=>{
console.log("run the demo")
let counter=0
console.log("begin the wait")
while (counter < 10000){
counter+=1
console.log(counter)
}
counter=0
this.props.setHighlightMode()
while (counter < 10000){
counter+=1
}
var docvalue= document.getElementById('regex-example').value
var selection = this.range(0,20,docvalue)//get selected chars in element
console.log("document value",docvalue)
console.log("selection in range",selection)
var selectedText = selection.toString(); //sends the elements to a string
console.log("selection text to update",selectedText)
{this.props.updateHighlight(selectedText)} //send highlight to main to send to notes
while (counter < 10000){
counter+=1
}
this.props.setHighlightMode()
counter=0
while (counter < 10000){
counter+=1
}
this.props.toggleMenu()
while (counter < 10000){
counter+=1
}
this.props.openNotes()
counter=0
while (counter < 10000){
counter+=1
}
counter=0
while (counter < 10000){
counter+=1
}
this.props.close()
counter=0
this.props.setScholarMode()
this.props.DemosynonymsFunction(selectedText.toString())
console.log("next return a synonym")
}
解决方案
推荐阅读
- spring-webflux - 奇怪的行为 webflux 然后操作员忽略错误
- javascript - vue.js中带有护照的令牌授权标头
- c# - 带有组合框的 Datagridview 引用自己的数据集混合行
- node.js - 解决时:@typegoose/typegoose@7.2.0 npm ERR!找到:mongoose@6.0.6 node_modules mongoose
- amazon-web-services - AWS Pinpoint 查看提交的记录
- artifactory - Artifactory Replication 默认\设置一次,复制给其他人
- jenkins - Jenkins 流水线:跳过 ARM 代理
- ssl - 了解如何使用 ARM PSA cryoto API 实现类似 TLS 的协议
- javascript - 级联行删除javascript
- javascript - 为什么可以通过浏览器访问网站,wheares编写简单的代码来获取,但得到403错误