window.location.href 和 this.props.history.push 的选择
来源:9-3 添加品类页面的开发

ywang04
2018-05-09
if(categoryName){ _product.saveCategory({ parentId : this.state.parentId, categoryName : categoryName }).then((res) => { _mm.successTips(res); this.props.history.push('/product-category/index'); }, (errMsg) => { _mm.errorTips(errMsg); }); }
this.props.history.push('/product-category/index') 如果换成window.location.href = '/product-category/index' 也是可以的,不知道老师推荐用哪个?
写回答
2回答
-
能用push的时候就用push,window.location.href会重新加载所有东西,不得已才用
00 -
棒棒锤皮皮虾
2018-05-09
两者都一样 this.props.history.push本质就是window.location.href
032018-05-10
相似问题