refactor: simplify OptimizedImage API and enforce src/srcSet validation#7
Merged
TomChicken-on-github merged 1 commit intomainfrom Feb 24, 2026
Conversation
Deploying wsmcs with
|
| Latest commit: |
e1e29f4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ffdda914.wsmcs.pages.dev |
| Branch Preview URL: | https://codex-refactor-optimizedimag.wsmcs.pages.dev |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for wsmcs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
OptimizedImage.vue,只保留多格式输出(<picture>)与单图回退的职责,去除与渐进加载相关的复杂状态与副作用。srcSet时必须提供src,从而避免在运行时出现不可预测的占位或空图像。Description
useImageOptimization、getThumbnailPath、缩略图相关 props(thumbnail)与状态、以及load/erroremit 和处理函数。<picture>(优先avif/webp)和v-else回退<img>,以及现有的loading/decoding/width/heightprops 与样式。src设置为可选(默认''),保留srcSet可选;新增运行时校验(watchEffect)在!srcSet && !src时抛错以强制校验。watchEffect,并更新组件注释以反映精简后的职责。Testing
npm run build成功,构建输出与 manifest 正常生成。Codex Task