Convert Figma logo to code with AI

Meituan-Dianping logompvue

基于 Vue.js 的小程序开发框架,从底层支持 Vue.js 语法和构建工具体系。

20,416
2,074
20,416
467

Top Related Projects

207,677

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core

39,886

A cross-platform framework using Vue.js

35,461

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/

🦎 一套代码运行多端,一端所见即多端所见

4,776

一个致力于微信小程序和 Web 端同构的解决方案

22,494

小程序组件化开发框架

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

  1. 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>
  1. Using lifecycle hooks:
<script>
export default {
  onLoad() {
    console.log('Page loaded')
  },
  onShow() {
    console.log('Page shown')
  },
  onHide() {
    console.log('Page hidden')
  }
}
</script>
  1. 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

  1. Install mpvue CLI:
npm install -g @mpvue/cli
  1. Create a new project:
mpvue init my-project
cd my-project
  1. Install dependencies and run the development server:
npm install
npm run dev
  1. Open the WeChat Developer Tools, import the project from the dist folder, and start developing your mini-program using Vue.js syntax.

Competitor Comparisons

207,677

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.

39,886

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.

35,461

开放式跨端跨框架解决方案,支持使用 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:

  1. chameleon uses a custom DSL with <view> instead of <div>
  2. chameleon employs a class-based component structure
  3. mpvue follows a more traditional Vue.js syntax
4,776

一个致力于微信小程序和 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.

22,494

小程序组件化开发框架

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 Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

mpvue logo

npm npm

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 文档

快速开始

我们精心准备了一个简单的 五分钟上手教程 方便你快速体验到 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 的项目

贡献方法

更多项目征集

分享交流群

NPM DownloadsLast 30 Days