在[background:url({{XXX}})no-repeat center center中,严格模式下不允许分配只读属性 [英] Assignment to read-only properties is not allowed in strict mode in [background: url({{XXX}}) no-repeat center center

查看:229
本文介绍了在[background:url({{XXX}})no-repeat center center中,严格模式下不允许分配只读属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Edge中遇到此错误,但在Chrome中一切正常 无法理解这里出了什么问题...

I am getting this error in Edge but in chrome everything is fine Unable to understand what is wrong here...

<div class="container-fluid project_img" style="background: url({{_project.images.web}}) no-repeat center center;">
      </div> 

Microsoft Edge中的错误:

Error in Microsoft Edge:

Assignment to read-only properties is not allowed in strict mode in [background: url({{_project.images.web}}) no-repeat center center; in ProjectDetailComponent

推荐答案

改为使用

<div class="container-fluid project_img" [style.background]="'url(' + _project.images.web + ') no-repeat center center;'">
  </div> 

这篇关于在[background:url({{XXX}})no-repeat center center中,严格模式下不允许分配只读属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆