0
React SimpleImage componentにはsrcSet
を使用してimgのsrcsetプロパティを使用しています。srcsetがimgで動作していない
コンポーネントコードを有する:
const image = (<img
{...imageStyle}
src={src}
srcSet={srcsetStr}
alt={alt}
width={width}
height={height}
role="presentation"
onLoad={onLoad}
onError={onFail}
/>);
画像をdiv
に配置されている:
return (<div {...wrapperStyle}>
{statusIndicator}
{image}
</div>);
wrapperStyleは次のように定義される:DIVに幅
const mainWrapperStyle = style({
backgroundColor: 'white',
backgroundSize: 'contain',
backgroundRepeat: 'none',
boxSizing: 'border-box',
position: 'relative',
width,
height,
}
img
の幅と同じです。
私はこのようになります生成されるマークアップのsrcsert
プロパティでエラーが出ます:
<img
srcset=" https://webkit.org/demos/srcset/image-src.png 1x
https://webkit.org/demos/srcset/image-2x.png 2x
https://webkit.org/demos/srcset/image-3x.png 3x
https://webkit.org/demos/srcset/image-4x.png 4x" width="800px"
height="800px" role="presentation"
src="https://webkit.org/demos/srcset/image-src.png"
data-css-44fijj="[* + *]"
>
私が持っているここでエラー:
DOMPropertyOperations.js?17f3:142 Failed parsing 'srcset' attribute value since it has an unknown descriptor.
私のコンポーネントで 'srcSet'を使用しました。生成されたマークアップの' srcset'属性は、isssue:https://github.com/vamsiampolu/css-in-js-test/blob/glamor/app/SimpleImageを引き起こします。 js – vamsiampolu