• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

推和替换

推是压入栈,留下访问痕迹,替换是代替,不留下访问痕迹

如果全部变为替换,那么就不会有后退功能了

回去:历史中实现后退的函数

前进:历史中实现前进的函数

去:历史中实现前进后退几步的函数,去吧(2)表示前进2步,go(-2)表示后退2步

代码如下

导出默认类消息扩展组件{

州={

messageArr: [

{ id: '1 ',标题: '消息1' },

{ id: '2 ',标题: '消息2' },

{ id: '3 ',标题: '消息3' }

]

}

handleReplace=(id,title)={

这个。道具。历史。替换(`/home/message/detail/$ { id }/$ { title } `)

}

handlePush=(id,title)={

这个。道具。历史。推送(`/home/message/detail/$ { id }/$ { title } `)

}

handleforward=()={

this.props.history.goForward()

}

handleBack=()={

this.props.history.goBack()

}

handleGo=()={

这个。道具。历史。去吧(2)

}

render() {

返回(

差异

保险商实验所

{

这个。状态。消息数组。map((msgObj)={

返回(

李key={msgObj.id}

{/* 向路由组件传递参数传递参数*/}

链接到={ '/home/message/detail/' msgobj。id“/”msgobj。title } { msgobj。title }/Link

nbspbutton onClick={()=this。手柄推动(msgobj。id,msgobj . title)}推送查看/按钮

nbspbutton onClick={()=this。把手更换(msgobj。id,msgObj.title)}替换查看/按钮

{/* 向路由组件传递搜索传递参数*/}

{/* Link to={ `/home/message/detail/?id=$ { msgobj。id } title=$ { msgobj。title } ` } { msgobj。title }/Link */}

{/* 向路由组件传递状态传递参数*/}

{/* Link to={ { path name : '/home/message/detail ',state: { id: msgObj.id,title : msgobj。title } } } { msgobj。title }/Link */}

/李

)

})

}

人力资源/

{/* 声明接收参数参数*/}

路由路径='/home/message/Detail/: id/: title ' component={ Detail }/

button onClick={ this。handleforward }前进/按钮

button onClick={ this。手柄背面}后退/按钮

button onClick={ this。处理go } go/按钮

{/* 声明接收搜索参数,无需声明接收,正常注册理由即可*/}

{/*路由路径='/主页/消息/详细信息'组件={Detail}/*/}

{/* 声明接收状态参数,无需声明接收,正常注册理由即可*/}

{/*路由路径='/主页/消息/详细信息'组件={Detail}/*/}

/ul

/div

)

}

}

备注:使用搜索和状态传参也都一样可以

Link to comment
Share on other sites