Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentWillReceiveProps(nextProps) {
this.props.setCurrentPage(nextProps.location);
if (nextProps.location && this.props.location) {
const pathnameChanged = nextProps.location.pathname !== this.props.location.pathname;
const queryChanged = nextProps.location.search !== this.props.location.search;
const isSearchPage = nextProps.location.pathname === '/search';
if (pathnameChanged || (queryChanged && isSearchPage)) {
animateScroll.scrollToTop({
duration: 500,
delay: 100,
smooth: true
});
}
}
}
constructor(props: any) {
super(props);
//组件初始化滚动到顶部
scroll.scrollToTop({
duration: 700,
delay: 0,
smooth: "easeOutQuad"
});
}
history.listen(location => {
const param = getAllUrlParams(location.search).hash;
if (!param)
scroll.scrollToTop({
duration: 0,
delay: 0,
smooth: false
});
});
.then(() => {
routerNavigate(2);
animateScroll.scrollToTop();
})
)}
const onNextStep = value => () => {
const nextStep = step + value;
scroll.scrollToTop(scrollConfig);
setTimeout(() => {
if (nextStep <= 4) {
setScreen('xs');
} else if (nextStep <= 8) {
setScreen('sm');
} else if (nextStep <= 12) {
setScreen('md');
}
setStep(nextStep);
}, 400);
};
return (
async componentDidMount() {
scroll.scrollToTop();
await this.getDetailPageData(this.props.match.params.productId);
}
const scrollToTop = () => {
scroll.scrollToTop()
}
componentDidMount() {
animateScroll.scrollToTop();
}
render() {
scrollTop = () => {
animateScroll.scrollToTop();
}
const scrollToTop = () =>{
scroll.scrollToTop();
};
return(