File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -137,13 +137,28 @@ function App() {
137137 top = { "30%" }
138138 display = { { base : "none" , lg : "block" } }
139139 > </ Box >
140- < Image
141- src = "/boximage.png"
140+ { /* 使用 picture 元素提供多种格式 */ }
141+ < Box
142142 w = { { base : "280px" , md : "400px" , lg : "640px" } }
143143 h = { { base : "280px" , md : "400px" , lg : "640px" } }
144144 position = { { base : "static" , lg : "absolute" } }
145- objectFit = "contain"
146- />
145+ >
146+ < picture >
147+ < source srcSet = "/boximage.webp" type = "image/webp" />
148+ < source srcSet = "/boximage.avif" type = "image/avif" />
149+ < Image
150+ src = "/boximage.png"
151+ alt = "Profile image"
152+ w = "100%"
153+ h = "100%"
154+ objectFit = "contain"
155+ loading = "eager"
156+ opacity = { imageLoaded ? 1 : 0 }
157+ transition = "opacity 0.3s ease"
158+ fallbackSrc = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAwIiBoZWlnaHQ9IjQwMCIgdmlld0JveD0iMCAwIDQwMCA0MDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI0MDAiIGhlaWdodD0iNDAwIiBmaWxsPSIjRjNGNEY2Ii8+CjxjaXJjbGUgY3g9IjIwMCIgY3k9IjIwMCIgcj0iNTAiIGZpbGw9IiNEMUQ1REIiLz4KPC9zdmc+"
159+ />
160+ </ picture >
161+ </ Box >
147162 < Flex >
148163 < VStack
149164 transform = { { base : "none" , lg : "translate(120px,100px)" } }
You can’t perform that action at this time.
0 commit comments