The H5 Developer's Field Manual for uni-app
A web developer who tries uni-app without unlearning browser reflexes will hit silent failures—missing `window`, broken navigation, and components that never render. This translation layer between the two worlds prevents those early dead ends and makes the framework's cross-platform promise actually deliverable.
A complete migration guide maps every familiar H5 concept to its uni-app equivalent. HTML files become `.vue` single-file components with separate `<template>`, `<script>`, and `<style>` blocks. The `<div>`, `<span>`, and `<img>` tags are replaced by `<view>`, `<text>`, and `<image>` components, while `document.getElementById()` gives way to Vue's MVVM data binding—modify a JavaScript variable and the UI updates automatically. Browser APIs like `window`, `document`, `localStorage`, and `fetch()` are all unavailable outside the H5 target; uni-app supplies its own `uni.*` API surface for network requests, storage, dialogs, and navigation.
The guide also details the five distinct page-navigation APIs (`navigateTo`, `redirectTo`, `switchTab`, `reLaunch`, `navigateBack`) and their page-stack semantics, the `easycom` convention that auto-imports components when folder and file names match, and the `rpx` unit that normalizes screen widths to 750rpx for responsive layouts. A decision tree for navigation, a CSS selector compatibility table, and a full lifecycle hook reference round out the practical instruction.
The hardest part of adopting uni-app isn't learning Vue syntax; it's suppressing the muscle memory of `document.querySelector` and `window.location` that the browser trained into every web developer.
The `easycom` convention is a sharp double-edged sword: it eliminates boilerplate but silently fails on case mismatches or missing folders, giving newcomers no error message to debug.
uni-app's API surface deliberately mirrors WeChat Mini Program's `wx.*` namespace, which means the framework inherits both the design decisions and the limitations of the mini-program ecosystem.
The 10-layer page-stack limit on WeChat Mini Programs is a runtime constraint that has no equivalent in traditional web navigation, and hitting it at runtime produces a silent failure rather than a clear error.