✨ 巧用等待状态,让产品响应更丝滑——《999 个小技巧,让你 Vibe 的产品更有质感》017 在实际运行的产品中,等待不可避免。如何把等待合理地告知用户,会影响用户的情绪和操作的流畅度,有时甚至应该先给出反馈,再根据结果更正。今天介绍几种常见的交互模式: Spinner:按钮搭配 Toast,适合几秒内就能完成的操作,如刷新、同步。点击后按钮图标原地旋转,结束后用 Toast 告知结果,轻量,也不打断操作。 Skeleton:页面结构已知时,先显示骨架,再换成真实内容。用户能提前知道内容会出现在哪里,内容到达后原位替换,页面不跳动。常见于信息流、图表等内容面积较大的场景。 Progress:明确告知用户进度和最终结果,常见于上传、导入、诊断等耗时任务。可以用 Toast 或通知卡片呈现,也可以嵌在页面或表单中。 Optimistic:严格来说,这是一种策略而非模式。对于大概率成功、也容易退回的操作,先显示结果,再在后台保存;保存失败时,把改动退回原处,说明原因,并提供重试。 另外,300ms 以内的等待通常不显示单独的加载状态,否则它刚出现就消失,看起来像闪了一下。 附一条 Prompt(比较长,如果你需要):它会先找出你的产品里所有需要等待的地方,逐个判断该用哪种方式,列出表格由你决定;确认后,再按视频中的效果改造 ⬇️
枯白啃设计

图标设计师 / 设计工程师

Prompt(2/3) e. An action that almost always works and is easy to reverse (mark done, like, rename, reorder, move, add a comment): optimistic. - Show the result at once, before the server answers, everywhere it appears (the tick, the status, the totals), and save behind it. Say quietly that it is saving, in a fixed place on the item (Saving, then Saved, fading after a moment), never with a spinner over the change itself. - If the save fails, put every part of the change back, say why on the item in a few words (Couldn’t save), and offer Retry in the place of the saving status. Keep what the person typed. - Not for payments, deleting for good, sending something to other people, or anything that cannot be quietly put back. f. AI answers and other results that arrive in pieces: - First say what it is doing, as steps (Reading 4 tasks, Checking 3 events, Writing the summary), each turning into a check. - Then write the answer as the words arrive, each fading in from a slight blur as the next begins, with a caret after the last. - Keep the answer's space from the start (a card at its final size, or a minimum height that only grows downward), so the page does not move as it writes. - At the end, show Copy and Retry. Offer a way to stop only when answers often run long. - Aim for the first words within 1 to 2s; when that is not possible, the steps must keep moving. g. Waits the person does not need to see (prefetching, saving a draft, syncing in the background): nothing, or a quiet status in a fixed place (Saved). Never block the page for them. 2. Rules for every kind - Thresholds: under 300ms nothing but a button's own icon turning; 300ms to 1s a spinner or skeleton; 1 to 10s a skeleton, or progress that says what it is doing; over 10s progress, the time left and a way out. Measure on a slow mobile network, not on localhost. - Delay and minimum: what appears after 300ms stays at least 500ms. Write one helper for this and use it everywhere. - The layout never moves when content arrives: reserve the space (skeletons at real size, minimum heights, fixed image ratios). - One indicator per wait: never a spinner on the button, an overlay on the page and a bar at the top all at once. - Keep what is known: when refreshing, keep showing the old data with a quiet refresh state, rather than a skeleton. - Failures stay where they happened, say what failed and what to do, and offer Retry. A toast that disappears is not enough for something the person has to fix. - Reduced motion: keep every state; drop the moving band and the spin, and use a soft opacity pulse or nothing. - Accessibility: aria-busy on the region that is loading, a polite live region for done and failed, focus left where it was, and a busy button still reachable by keyboard. 3. Report before changing anything Give me a table first, and do not change code yet. One row per wait: - Where: the screen or component, and what starts the wait. - Now: how long it takes, and what is shown. - Should be: nothing, spinner, skeleton, progress, optimistic, AI answer, or background; and why, in a phrase that points to the rule above. - Change: what you would do, in a phrase. Group the rows by kind. Then list the shared pieces you would add or change (the delay helper, skeleton shapes, the progress notification). Wait for me to choose what to change. 4. How it looks (defaults; fit them to my design) - Spinner: the loading icon from my icon set (or a ring segment on a faint track), 12 to 16px, a turn every 0.9s, in the accent or the text colour. In a button, an icon that already means the action turns instead, speeding up over the first 18% and slowing over the last 18% so it starts and stops at rest: one turn in 640ms at the least, and on at about 600° a second for longer waits (three turns in 1.7s), always ending on a whole turn; otherwise the icon cross-fades into the spinner over 180ms with a little blur and scale. The label and width stay. - Toast: 40px tall with a 16px corner, a check on a soft tile and a few words, top centre of the content; it comes down 10px from a slight blur over 500ms, and leaves after about 3s. - Skeleton: shapes in the raised grey (rgb(240 240 242) on white; on dark, white at 8%), 6px corners for lines, circles for pictures, 12px lines for 14px text. The band is white at 75%, 320px wide, crossing the whole list at once.
登录并发表评论

评论 · 0