当前位置: 首页 > 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.jsqmd.com/news/941665/

相关文章:

  • Windows 10/11 C盘告急?用mklink命令把VSCode扩展文件夹挪到D盘,实测有效
  • 云原生生态解析:主流厂商与核心技术栈
  • 从实验室到街头:拥抱复杂性的研究范式变革与实战指南
  • 避坑指南:在Linux服务器上为个人项目安装CUDA 11.1,如何避免污染系统环境?
  • 搞定Xilinx CPRI IP核的时钟同步:从GT恢复时钟到外部PLL的保姆级配置指南
  • 告别SpeechRecognition!用阿里FunASR搞定会议录音转文字(附离线模型部署避坑指南)
  • Protobuf动态解析避坑指南:从Descriptor文件生成到DynamicMessage实战
  • UE5 SpatialLabs插件实战:如何解决摄像机外物体不显示这个“反常识”的立体成像问题?
  • 爆炸金属复合板厂家推荐:威海化机凭双工艺技术领跑高端防腐材料赛道 - 玖叁鹿
  • 别再凭感觉画线了!用这个在线工具5分钟搞定PCB电源线宽计算(附IPC-2152标准解读)
  • 全网最细java零基础学习就业课程教学之java基础篇3
  • 别再为ImageNet发愁了!3GB的Mini-ImageNet数据集保姆级处理教程(附Python脚本)
  • 钢材的机械性能浅析
  • Zotero插件市场:3步完成插件管理的终极指南
  • Python函数:局部变量与全局变量的作用域
  • 耐火浇注料供应商怎么选?2026年行业深度解析与优质厂家推荐 - 深度智识库
  • 资源等待与系统吞吐—— 从线程、连接到 TCP 带宽利用率
  • 别再堆技术了!高并发高可用下单系统,真正的架构精髓在这里
  • YOLOv8安装踩坑记:手动创建setup.py和requirements.txt的保姆级教程
  • 5个突破性技巧彻底改变你的OneNote笔记管理效率
  • 当AI学会了“理解“医院:医疗企业本体语义模型落地记
  • 揭秘Chromatic:5分钟掌握Chromium/V8应用的终极修改神器
  • Ubuntu 根分区文件系统损坏,系统启动时自动检查失败
  • ACE-Guard限制器:腾讯游戏性能优化终极指南
  • 洛阳市涧西区 清洁收纳上门|维小达 日常保洁、开荒保洁、窗户保洁、收纳整理、暖气清洗、家电清洗等一站式清洁收纳服务 - 维小达科技
  • STM32F103C8T6直接驱动SG90舵机的PWM控制工程(标准库版,含接线图与示例)
  • 除了禁用Domain Reload,Unity项目编译提速还有哪些靠谱选择?实测对比与避坑指南
  • 一张图搞懂 HarmonyOS SnapshotUtil:什么场景用哪个截图方法?
  • 保姆级教程:用CrewAI+Ollama在本地电脑搭建你的第一个多Agent协作项目(附避坑指南)
  • 社交媒体健康洞察:从数据挖掘到公共健康监测的实践指南