1

在 IE11 中,Picturefill库不适用于 Vue.js。我收到以下警告:

[Vue warn]: Unknown custom element: <picture> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

我可以通过使用删除警告,Vue.config.ignoredElements = ['picture']但这似乎并不能解决问题。我认为在引擎盖下 Vue.js 正在使用图片标签做事,因为它没有被 IE11 识别,因此 Vue.js 认为它​​是一个自定义标签?

请让我知道如何解决这个问题!谢谢

4

1 回答 1

1

对于 IE11,您必须在 DOM 中加载图片标签后调用图片填充函数。它会将 src 属性动态添加到 img 标签。

//For IE 11 Fix
    if(typeof picturefill === "function") {
      picturefill();
    }
于 2017-06-16T07:45:44.087 回答