react锚点

DOCTYPE html >
< html lang= "en" >
< head >
< meta charset= "UTF-8" >
< meta name= "viewport" content= "width=device-width, initial-scale=1.0" >
< meta http-equiv= "X-UA-Compatible" content= "ie=edge" >
< title >Document title >
head >
< body >
< div id= "app" > div >
< script src= "bower_components/react/react.production.min.js" > < / script >
< script src= "bower_components/react/react-dom.production.min.js" > < / script >
< script src= "bower_components/babel/browser.js" > < / script >
< script type= "text/babel" >
class Target extends React.Component {
render() {
return(
< div >
< a href= '#test' >会议记录 a >
< a href= '#test1' >会议记录1 a >
< a style= {{ 'margin-top': '2000px', 'display': 'block'} } name= 'test'             >hahha a >
< a style= {{ 'margin-top': '3000px', 'display': 'block'} } name= 'test1             ' >hahha1 a >
div >
);
}
}
ReactDOM.render(
< Target />,
document.getElementById( "app")
);
< / script >
body >
html >
因为 react不能用id,所以用a标签的name属性代替

你可能感兴趣的:(react锚点)