第一步:安装这个插件
npm i smoothscroll-polyfill
第二步:在你需要解决问题的页面引入
import smoothscroll from 'smoothscroll-polyfill';
第三步:执行这个方法(就是在你用behavior:'smooth'的事件里面写入)
smoothscroll.polyfill();
这样就可以解决behavior: 'smooth' 在手机上不平滑的问题了
第一步:安装这个插件
npm i smoothscroll-polyfill
第二步:在你需要解决问题的页面引入
import smoothscroll from 'smoothscroll-polyfill';
第三步:执行这个方法(就是在你用behavior:'smooth'的事件里面写入)
smoothscroll.polyfill();
这样就可以解决behavior: 'smooth' 在手机上不平滑的问题了