Top Related Projects
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
A cross-platform framework using Vue.js
开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
🦎 一套代码运行多端,一端所见即多端所见
一个致力于微信小程序和 Web 端同构的解决方案
小程序组件化开发框架
Quick Overview
mpvue is a Vue.js-based framework for building small programs (mini-programs) for WeChat and other platforms. It allows developers to use Vue.js syntax and components to create mini-programs, bridging the gap between web and mini-program development.
Pros
- Leverages Vue.js ecosystem and syntax, reducing learning curve for Vue developers
- Supports multiple mini-program platforms (WeChat, Alipay, Baidu, etc.)
- Provides better performance compared to native mini-program development
- Offers a more maintainable and scalable codebase structure
Cons
- Limited community support and updates (last commit was in 2019)
- May not support the latest features of mini-program platforms
- Potential compatibility issues with some Vue.js plugins and libraries
- Debugging can be more challenging compared to native mini-program development
Code Examples
- Creating a simple component:
<template>
<div>
<p>{{ message }}</p>
<button @click="changeMessage">Change Message</button>
</div>
</template>
<script>
export default {
data() {
return {
message: 'Hello, mpvue!'
}
},
methods: {
changeMessage() {
this.message = 'Message changed!'
}
}
}
</script>
- Using lifecycle hooks:
<script>
export default {
onLoad() {
console.log('Page loaded')
},
onShow() {
console.log('Page shown')
},
onHide() {
console.log('Page hidden')
}
}
</script>
- Accessing mini-program APIs:
<template>
<button @click="showToast">Show Toast</button>
</template>
<script>
export default {
methods: {
showToast() {
wx.showToast({
title: 'Hello from mpvue!',
icon: 'success',
duration: 2000
})
}
}
}
</script>
Getting Started
- Install mpvue CLI:
npm install -g @mpvue/cli
- Create a new project:
mpvue init my-project
cd my-project
- Install dependencies and run the development server:
npm install
npm run dev
- Open the WeChat Developer Tools, import the project from the
dist
folder, and start developing your mini-program using Vue.js syntax.
Competitor Comparisons
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
Pros of Vue
- More versatile and can be used for various types of web applications
- Larger community and ecosystem, leading to better support and resources
- Regular updates and active maintenance by the core team
Cons of Vue
- Steeper learning curve for beginners compared to mpvue
- Requires additional configuration for mobile and small-scale applications
- May have more overhead for simple projects
Code Comparison
Vue:
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return {
message: 'Hello Vue!'
}
}
}
</script>
mpvue:
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return {
message: 'Hello mpvue!'
}
}
}
</script>
The code structure is similar, as mpvue is based on Vue. The main difference lies in the runtime environment and available APIs. Vue is designed for web applications, while mpvue is tailored for WeChat Mini Programs and other small-scale mobile applications. mpvue provides a more straightforward approach for developing these types of applications, but with limited flexibility compared to Vue's broader capabilities.
A cross-platform framework using Vue.js
Pros of uni-app
- Supports multiple platforms, including iOS, Android, Web, and various mini-program platforms
- Provides a rich set of UI components and APIs for faster development
- Active community with frequent updates and improvements
Cons of uni-app
- Steeper learning curve due to its custom syntax and framework-specific concepts
- May have limitations when implementing complex, platform-specific features
- Larger bundle size compared to mpvue for simple applications
Code Comparison
mpvue:
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return { message: 'Hello, mpvue!' }
}
}
</script>
uni-app:
<template>
<view>{{ message }}</view>
</template>
<script>
export default {
data() {
return { message: 'Hello, uni-app!' }
}
}
</script>
The main difference in the code is the use of <view>
instead of <div>
in uni-app, as it uses custom components that map to native elements on different platforms.
开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
Pros of Taro
- Supports multiple platforms including React Native, H5, and various mini-programs
- Offers a larger ecosystem with more plugins and components
- Provides better TypeScript support and type checking
Cons of Taro
- Steeper learning curve due to its more complex architecture
- May have slower compilation times for larger projects
- Requires more configuration and setup compared to mpvue
Code Comparison
mpvue:
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return { message: 'Hello, mpvue!' }
}
}
</script>
Taro:
import React from 'react'
import { View, Text } from '@tarojs/components'
export default function Index() {
return <View><Text>Hello, Taro!</Text></View>
}
Both frameworks aim to simplify cross-platform development for mini-programs and web applications. mpvue leverages Vue.js syntax and concepts, making it easier for Vue developers to adopt. Taro, on the other hand, uses React-like syntax and offers broader platform support, including React Native. While mpvue may be simpler to start with, Taro provides more flexibility and scalability for complex projects across multiple platforms.
🦎 一套代码运行多端,一端所见即多端所见
Pros of chameleon
- Multi-platform support: Targets web, WeChat mini-programs, Alipay mini-programs, Baidu smart programs, and native apps
- Built-in UI components: Provides a set of cross-platform UI components
- Runtime adaptation: Dynamically adapts to different platforms at runtime
Cons of chameleon
- Steeper learning curve: Requires understanding of its custom DSL and APIs
- Less mature ecosystem: Fewer third-party plugins and community resources compared to mpvue
Code comparison
mpvue:
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return { message: 'Hello mpvue' }
}
}
</script>
chameleon:
<template>
<view>{{message}}</view>
</template>
<script>
class Index {
data = {
message: 'Hello chameleon'
}
}
export default new Index();
</script>
The main differences in the code examples are:
- chameleon uses a custom DSL with
<view>
instead of<div>
- chameleon employs a class-based component structure
- mpvue follows a more traditional Vue.js syntax
一个致力于微信小程序和 Web 端同构的解决方案
Pros of kbone
- Supports multiple frameworks (Vue, React, Preact) unlike mpvue which is Vue-specific
- Offers better performance and smaller package sizes
- Provides a more native web development experience
Cons of kbone
- Steeper learning curve compared to mpvue's simpler approach
- Less mature ecosystem and community support
- May require more configuration and setup
Code Comparison
mpvue:
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return { message: 'Hello, mpvue!' }
}
}
</script>
kbone:
import { h, render } from 'preact'
function App() {
return h('div', null, 'Hello, kbone!')
}
render(h(App), document.body)
The code examples showcase the different approaches:
- mpvue uses Vue's template syntax and component structure
- kbone allows for more flexibility, shown here with Preact's JSX-like syntax
Both frameworks aim to simplify mini-program development, but kbone offers more options and closer alignment with web standards at the cost of increased complexity. mpvue provides a more straightforward Vue-based solution but with less flexibility and performance optimizations.
小程序组件化开发框架
Pros of wepy
- More mature and stable framework with longer development history
- Supports both Vue.js and React syntax, offering flexibility
- Provides a CLI tool for project scaffolding and management
Cons of wepy
- Steeper learning curve due to custom syntax and conventions
- Less seamless integration with existing Vue.js projects
- Smaller community and ecosystem compared to mpvue
Code Comparison
mpvue:
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
data() {
return { message: 'Hello, mpvue!' }
}
}
</script>
wepy:
<template>
<view>{{ message }}</view>
</template>
<script>
import wepy from 'wepy'
export default class extends wepy.page {
data = {
message: 'Hello, wepy!'
}
}
</script>
Both frameworks aim to simplify WeChat Mini Program development using Vue-like syntax. mpvue stays closer to standard Vue.js, making it easier for Vue developers to adopt. wepy introduces its own conventions and syntax, which may require more learning but offers additional features specific to Mini Program development.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
mpvue
Vue.js å°ç¨åºç, fork èª vuejs/vue@2.4.1ï¼ä¿çäº vue runtime è½åï¼æ·»å äºå°ç¨åºå¹³å°çæ¯æã
mpvue
æ¯ä¸ä¸ªä½¿ç¨ Vue.js å¼åå°ç¨åºçå端æ¡æ¶ï¼ç®åæ¯æ 微信å°ç¨åº
ãç¾åº¦æºè½å°ç¨åº
ï¼å¤´æ¡å°ç¨åº
å æ¯ä»å®å°ç¨åº
ã æ¡æ¶åºäº Vue.js
ï¼ä¿®æ¹äºçè¿è¡æ¶æ¡æ¶ runtime å代ç ç¼è¯å¨ compiler å®ç°ï¼ä½¿å
¶å¯è¿è¡å¨å°ç¨åºç¯å¢ä¸ï¼ä»è为å°ç¨åºå¼åå¼å
¥äº Vue.js
å¼åä½éªã
mpvue 2.0
mpvue 2.0 å¼å§æ£å¼æ¯æ ç¾åº¦æºè½å°ç¨åºã头æ¡å°ç¨åº å æ¯ä»å®å°ç¨åºï¼ä½¿ç¨ mpvue-quickstart
项ç®æ¨¡æ¿æ°å建ç项ç®ï¼å°é»è®¤åçº§å° 2.0ãè项ç®å¯ç»§ç»ä½¿ç¨åæçæ¬ã详æ
请åè§ mpvue 2.0 å级æå
æ°çæ¬çé®é¢æ建议ï¼æ请åä½å ³æ³¨è åæ¶åé¦ï¼mpvue 2.0 ç¥å¤§å®¶èæ¥å¿«ä¹~ -2019.02.14
mpvue 1.x 稳å®çæ¬
对äºä¸å级 2.0 ç项ç®ï¼å¯ä»¥ç»§ç»ä½¿ç¨1.x ç大çæ¬ï¼ç®å1.x ä¼æç»å¨ 1.4.x ä¸ç»§ç»ç»´æ¤ å级æ¹å¼åè§ï¼1.x 稳å®ç说æ
å¿«éå¼å§
æ们精å¿åå¤äºä¸ä¸ªç®åç äºåéä¸ææç¨ æ¹ä¾¿ä½ å¿«éä½éªå° mpvue
带æ¥çå¼åä¹è¶£ã
å称ç±æ¥
mp
ï¼mini program ç缩åmpvue
ï¼Vue.js in mini program
主è¦ç¹æ§
ä½¿ç¨ mpvue
å¼åå°ç¨åºï¼ä½ å°å¨å°ç¨åºææ¯ä½ç³»çåºç¡ä¸è·åå°è¿æ ·ä¸äºè½åï¼
- å½»åºçç»ä»¶åå¼åè½åï¼æé«ä»£ç å¤ç¨æ§
- å®æ´ç
Vue.js
å¼åä½éª - æ¹ä¾¿ç
Vuex
æ°æ®ç®¡çæ¹æ¡ï¼æ¹ä¾¿æ建å¤æåºç¨ - å¿«æ·ç
webpack
æ建æºå¶ï¼èªå®ä¹æ建çç¥ãå¼åé¶æ®µ hotReload - æ¯æä½¿ç¨ npm å¤é¨ä¾èµ
- 使ç¨
Vue.js
å½ä»¤è¡å·¥å · vue-cli å¿«éåå§åé¡¹ç® - H5 代ç 转æ¢ç¼è¯æå°ç¨åºç®æ 代ç çè½å
å ¶å®ç¹æ§æ£å¨ççä½ å»æ¢ç´¢ã
é å¥è®¾æ½
mpvue
ä½ä¸ºå°ç¨åºçæ¬ç Vue.js
ï¼å¨æ¡æ¶ SDK ä¹å¤ï¼å®æ´çææ¯ä½ç³»è¿å
æ¬å¦ä¸è®¾æ½ã
- mpvue-loader æä¾ webpack çæ¬çå è½½å¨
- mpvue-webpack-target webpack æ建ç®æ
- postcss-mpvue-wxss æ ·å¼ä»£ç 转æ¢é¢å¤çå·¥å ·
- px2rpx-loader æ ·å¼è½¬åæ件
- mpvue-quickstart mpvue-quickstart
- mpvue-simple è¾ å© mpvue å¿«éå¼å Page / Component 级å°ç¨åºé¡µé¢çå·¥å ·
- å ¶å®
ä½¿ç¨ mpvue ç项ç®
Top Related Projects
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
A cross-platform framework using Vue.js
开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
🦎 一套代码运行多端,一端所见即多端所见
一个致力于微信小程序和 Web 端同构的解决方案
小程序组件化开发框架
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot