1. 常见问题

  • 问: 页面锚点如何导航

    答:

    『方案一』:为锚点添加点击事件

    scrollToAnchor = (anchorName) => {
        if(anchorName) {
          let anchorEle = document.getElementById(anchorName);
          if(anchorEle) {
            anchorEle.scrollIntoView();
          }
        }
      }
    

    添加点击

    <a onClick={()=> scrollToAnchor(name)}>click me </a>
    
Copyright © tuzhu008 2017 all right reserved,powered by Gitbook该文件修订时间: 2018-01-06 00:20:40

results matching ""

    No results matching ""