docs(openspec): record Taro deferral decision for add-mobile-h5

This commit is contained in:
Chengdong Zhang
2026-09-28 13:36:43 +08:00
parent 9904696e76
commit add9f87703
+30
View File
@@ -0,0 +1,30 @@
# Design: mobile H5 (add-mobile-h5)
## Decision: Nuxt 3 H5 now, Taro deferred
Chosen: a first-party Nuxt 3 H5 app (`apps/mobile`) reusing `@vmall/shared`,
`theme.css`, and `@vmall/ui`.
Considered and deferred: **Taro (Vue 3) for H5 + WeChat mini-program from one
codebase**. Taro is only worth its cost when the mini-program is a committed
target: `@vmall/ui` is DOM-based and does not run in a mini-program, Tailwind
needs plugin+rpx workarounds there, `createApi` needs a transport adapter
(`fetch` does not exist in MP), and MP login needs a wx.login → openid
backend endpoint. For H5 alone, Nuxt is strictly better. Deferring Taro later
loses little: it would share neither the UI kit nor page code with the Nuxt
app anyway.
## If the mini-program becomes a target later
Split into three changes instead of one big-bang:
1. `add-mobile-taro-scaffold` — Taro 4 + Vue 3 workspace app, `createApi`
transport injection (fetch on H5, `Taro.request` on MP), tab-bar shell,
account+password login (works on both, no wx APIs). Acts as the
compatibility spike (Taro 4 + pnpm monorepo + CSS variables in WXSS).
2. `add-mobile-h5-flows` — the page inventory from this change, delivered on
the Taro H5 build.
3. `add-mobile-miniprogram` — MP build target, wx.login session exchange
endpoint, share/subscribe messages. Payments can ride the existing wallet
(balance payment) to avoid `wx.requestPayment` merchant onboarding; top-up
stays on H5/PC.