当前位置: 首页 > news >正文

前端工程化命题,覆盖性能/架构/交互

这里整理了五条前端开发命题。这些题目不谈虚的,不追求花哨的视觉效果,而是直击前端工程中的痛点:长列表渲染、复杂状态同步、离线优先、构建优化以及无障碍访问。它们适合用来检验开发者是否具备处理真实业务场景的能力,而不仅仅是会写页面。

1. Virtualized Data Grid with Complex Sorting

Build a high-performance data grid that renders 100,000 rows of mock user data. The core requirement is windowing/virtualization: only render the DOM nodes currently visible in the viewport. Implement column sorting (string, number, date) and filtering that updates the view instantly without blocking the main thread for more than 16ms. Use Web Workers for heavy sorting logic if necessary. The grid must support resizable columns and sticky headers. Do not use any third-party grid libraries (like AG Grid or TanStack Table); implement the virtualization logic from scratch using React hooks or vanilla JS. Measure performance using Chrome DevTools Performance tab; ensure no layout thrashing during scroll.

2. Optimistic UI Todo List with Conflict Resolution

Create a task management app that demonstrates Optimistic UI patterns. When a user adds, edits, or deletes a task, update the UI immediately before the API response returns. Simulate network latency (random 500-2000ms delay) and occasional random failures (10% chance). If the API fails, revert the UI change and show a non-intrusive error toast with a "Retry" button. Handle race conditions: if a user edits a task twice quickly, ensure the final state matches the last intended action, not necessarily the last received response. Use Redux Toolkit or Zustand for state management to track pending states separately from confirmed states.

3. Offline-First Note Taking App with Service Workers

Develop a note-taking application that works fully offline. Use Service Workers to cache the application shell and sync data when the connection is restored. Store notes in IndexedDB using a wrapper like idb or Dexie.js. Implement a background sync mechanism: if a user creates a note while offline, queue the request and send it to the server once online. Handle conflicts: if the same note was edited on another device while offline, prompt the user to choose which version to keep. The app must load instantly on subsequent visits, even without a network connection. Provide a visual indicator showing online/offline status and sync progress.

4. Custom Build Pipeline for Legacy Browser Support

Set up a modern frontend project (using Vite or Webpack) that targets both modern browsers (Chrome 100+) and legacy browsers (IE11). Configure the build pipeline to automatically generate two bundles: one modern bundle with ES6+ features and tree-shaking, and one legacy bundle transpiled to ES5 with polyfills. Use the module/nomodule pattern to serve the correct bundle to the correct browser. Implement code splitting so that polyfills are only loaded for legacy browsers. Measure the bundle size difference and document the configuration steps. The goal is to minimize the payload for modern users while maintaining compatibility for legacy ones without maintaining two separate codebases.

5. Accessible Modal Dialog with Focus Trapping

Implement a reusable Modal component that strictly adheres to WAI-ARIA Authoring Practices. When the modal opens, focus must move to the first interactive element inside it. Tabbing through elements must trap focus within the modal; pressing Tab on the last element should loop back to the first, and Shift+Tab on the first should loop to the last. Pressing Escape must close the modal and restore focus to the element that triggered it. Ensure screen readers announce the modal title and content upon opening. Disable scrolling on the body element when the modal is open. Test with NVDA or VoiceOver to verify accessibility. No external accessibility libraries allowed; implement all logic natively.

这五个命题涵盖了前端开发的几个核心硬技能:大数据量下的渲染性能、网络不稳定时的用户体验、离线存储与同步、构建工具的深度定制以及无障碍访问的合规性。能扎实完成这些任务,说明开发者已经脱离了“切图仔”的阶段,具备了独立解决复杂工程问题的能力。

http://www.rkmt.cn/news/1453087.html

相关文章:

  • 云原生生态解析:主流厂商与核心技术栈
  • 资源等待与系统吞吐—— 从线程、连接到 TCP 带宽利用率
  • 钢材的机械性能浅析
  • Ubuntu 根分区文件系统损坏,系统启动时自动检查失败
  • ACE-Guard限制器:腾讯游戏性能优化终极指南
  • 社交媒体健康洞察:从数据挖掘到公共健康监测的实践指南
  • 杭州特产避坑指南:双非遗杨先生糕点才是伴手礼天花板,芡实糕 + 麻花闭眼入不踩雷 - 玖叁鹿
  • OrCAD CIS数据库配置全攻略:从Access到ODBC,一步一图搞定元器件统一管理
  • 钢材的品种及规格
  • HarmonyOS 组件参数类型校验怎么做才对?TypeUtil 全面实战
  • Windows Cleaner完整指南:免费开源解决C盘空间不足的终极方案
  • 2026广州荔湾区外贸公司注册攻略|荔湾专业靠谱财税公司推荐 - 资讯速览
  • 生物识别技术如何解决结核病治疗依从性难题:一个公共卫生领域的创新实践
  • Speller100:零样本多语言拼写纠错系统的架构设计与工程实践
  • 别再傻傻分不清了!一文搞懂卫星测高里的SLA和SSHA(附数据处理实战)
  • 山大软院众智科学实验2022全套实操资料:5个C++实验源码+exe+报告+大纲
  • 兰州装修公司必读:石膏线源头直供vs中间商加价,一篇文章省3000-5000元 - 优质企业观察收录
  • Unity+Vuforia室内AR导航可运行示例工程(含路径指引与目标标记)
  • 别再死记硬背公式了!用OpenCV+Python从零实现一个SGM立体匹配算法(保姆级教程)
  • 南宁黄金回收全攻略:实测四大靠谱商家,手把手教你避开所有“坑”! - 行行星
  • 2026年西藏钢结构工程材料采购守则:源头工厂直供与物流保障完全剖析 - 企业名录优选推荐
  • 告别分区烦恼!用Ventoy+VMware把Ubuntu塞进U盘,一个.vtoy文件走天下
  • Scarab模组管理器:让空洞骑士模组安装变得前所未有的简单
  • Redis 入门必学:List 列表类型完全指南
  • VLC for Android 架构深度解析:跨平台媒体播放器完整技术实现指南
  • 哈尔滨黄金回收人气榜本地论坛票选,得票最高的竟是这家 - 奢侈品回收测评
  • NHSE:5个核心功能解锁你的动森岛屿无限可能
  • 基于Cortana与本地中间件构建智能学术研究助手:从语音交互到工作流自动化
  • 从“灵光一现”到“民主投票”:Self-Consistency如何改变了我们使用ChatGPT的方式?
  • 2026 年 6 月长春市卫生间阳台屋顶漏水防水补漏避坑指南 - 吉修匠