An Overview of mpvue: A Vue.js‑Based Framework for WeChat Mini Programs

mpvue is a Vue.js‑based framework that lets developers write WeChat Mini Programs using familiar Vue syntax, providing component, lifecycle and event mapping to achieve high code reuse between H5 web apps and Mini Programs, evolving through three stages, supporting bidirectional reuse while noting current Vue feature limitations and best‑practice guidelines.

Meituan Technology Team
Meituan Technology Team
Meituan Technology Team
An Overview of mpvue: A Vue.js‑Based Framework for WeChat Mini Programs

mpvue is a front‑end framework that enables developers to build WeChat Mini Programs using Vue.js, providing a complete Vue development experience and code reuse between H5 web applications and Mini Programs.

The project has been validated in multiple Meituan‑Dianping business projects and is now open‑sourced on GitHub: https://github.com/Meituan-Dianping/mpvue .

Key motivations for creating mpvue include rapid development, high code reuse, low cost, and improved development efficiency. Traditional Mini Program development faces challenges such as incomplete component mechanisms, limited multi‑platform code reuse, and a relatively high learning curve.

mpvue addresses these challenges by adopting Vue.js as the development language, offering a component system, lifecycle mapping, and event proxying that bridge Vue.js and Mini Program runtimes.

Evolution of mpvue

The framework evolved through three stages:

Stage 1: a view‑layer conversion tool that transformed H5 view code into Mini Program code, achieving limited reuse.

Stage 2: a refined component mechanism based on Vue component specifications, handling data sync, lifecycle linking, and namespace issues.

Stage 3: full support for the complete Vue.js syntax by integrating a custom Vue runtime for the Mini Program platform.

Design ideas

Vue.js and Mini Programs share a data‑driven view‑update model. mpvue maps Vue data changes to Mini Program pages, synchronizes lifecycles, and proxies events, as illustrated in the following figures.

Figure 1: Mini Program implementation principle

Figure 2: mpvue implementation principle

How to use mpvue

Install the Vue CLI globally, initialize a project from the mpvue template, install dependencies, and start the development server. The built output in the dist directory can be loaded into the Mini Program developer tools.

# Install vue-cli
$ npm install --global vue-cli
# Create project from template (internal repository)
$ vue init 'bitbucket:xxx.meituan.com:hfe/mpvue-quickstart' --clone my-project
# Install dependencies and start dev
$ cd my-project
$ npm install
$ npm run dev

mpvue supports two main code‑reuse scenarios:

H5 → Mini Program : replace the Mini Program‑specific Vue runtime and loader with the standard Vue.js equivalents, then adapt platform‑specific APIs.

Mini Program → H5 : use the same Vue source code, swapping the Mini Program runtime for the standard Vue runtime and adjusting API calls.

Current limitations are listed in Table 1 (e.g., slots, filters, and some advanced Vue features are not yet supported).

Table 1: mpvue unsupported syntax features

Best practices

Use vue-cli to scaffold projects and develop with Vue 2.x syntax.

Avoid unsupported Vue syntax (e.g., slots, filters).

Design fine‑grained data models to control updates and avoid performance issues.

Leverage component‑based development to maximize code reuse.

Table 2: Comparison of Mini Program frameworks (mpvue, WePY, native)

Conclusion: mpvue has been proven in large‑scale production at Meituan‑Dianping, continues to evolve with Vue.js releases, and aims to lower the barrier for Vue developers to adopt Mini Program development, offering a unified code base and improved development efficiency.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

WeChat Mini ProgramVue.jsCross‑platform developmentFront‑end Frameworkmpvue
Meituan Technology Team
Written by

Meituan Technology Team

Over 10,000 engineers powering China’s leading lifestyle services e‑commerce platform. Supporting hundreds of millions of consumers, millions of merchants across 2,000+ industries. This is the public channel for the tech teams behind Meituan, Dianping, Meituan Waimai, Meituan Select, and related services.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.