Skip to content

Vant

Mobile H5 app based on Vant 4.x.

Features

  • Vant components on-demand loading, auto-registered via VantResolver — no app.use(Vant) needed
  • Full CSS loaded (vant/lib/index.css) to ensure Toast/Dialog functional components render correctly
  • Built-in showToast, showDialog API-style calls

Run

bash
pnpm dev:vant

Default port: 5778

On-demand Loading

ts
// bootstrap.ts
// ✅ Import global base styles only; Vant component CSS is injected on-demand by VantResolver
import "@vh5/styles/global";
// ❌ Do NOT use app.use(Vant) for global registration
// ❌ Do NOT import vant/lib/index.css (conflicts with Resolver on-demand injection)

VantResolver defaults to importStyle: true, automatically injecting each component's CSS when used, ensuring correct style load order.

Vant Components Used

ComponentUsage
van-nav-barTop navigation bar
van-tabbarBottom tab bar
van-cell / van-cell-groupProduct list / item
van-swipeCarousel
van-form / van-fieldLogin form
van-imageImage display
van-buttonButton
van-tagTag
van-emptyEmpty state
van-back-topBack to top
showToastToast message (API)
showDialogDialog (API)

Released under the MIT License.