在 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 认为它是一个自定义标签?
请告诉我如何解决这个问题!谢谢
最佳答案
对于 IE11,在图片标签加载到 DOM 中后,您必须调用图片填充函数。它会动态地将 src 属性添加到 img 标签中。
//For IE 11 Fix
if(typeof picturefill === "function") {
picturefill();
}
关于javascript - 使用 Vue.js 在 IE11 中填充图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42223755/