为了账号安全,请及时绑定邮箱和手机立即绑定

Lint错误-意外的字符串连接

Lint错误-意外的字符串连接

莫回无 2021-04-08 13:15:11
render() {    const { a, b } = this.props;    if (// some condition // )    window.location.assign('/v2#/org/' + a + '/support')}}对于这一行,window.location.assign('/v2#/org/' + orgId + '/support')}我得到了lint错误-意外的字符串连接。如何防止这种情况发生?
查看完整描述

2 回答

?
拉风的咖菲猫

TA贡献1995条经验 获得超2个赞

您应该使用由“`”(反勾/重音符号)包裹的模板字符串。

window.location.assign(`/v2#/org/${orgId}/support`)


查看完整回答
反对 回复 2021-04-29
?
MM们

TA贡献1886条经验 获得超2个赞

使用字符串插值代替:


render() {

    const { a, b } = this.props;

    if (// some condition // )

    window.location.assign(`/v2#/org/${a}/support`)}

}


查看完整回答
反对 回复 2021-04-29
  • 2 回答
  • 0 关注
  • 147 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信