Convert Figma logo to code with AI

Tencent logowepy

小程序组件化开发框架

22,494
3,048
22,494
384

Top Related Projects

207,677

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

A framework for building native applications using React

35,461

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

39,886

A cross-platform framework using Vue.js

16,243

🌱 React and redux based, lightweight and elm-style framework. (Inspired by elm and choo)

18,267

A framework for building Mobile cross-platform UI

Quick Overview

WePY is a component-based framework for developing WeChat Mini Programs. It aims to improve development efficiency and code maintainability by introducing a Vue.js-like syntax and component system, along with various optimizations and features tailored for the WeChat Mini Program ecosystem.

Pros

  • Familiar Vue.js-like syntax and component system, making it easier for Vue developers to transition to WeChat Mini Program development
  • Built-in compiler for optimizing and enhancing the development experience
  • Rich ecosystem with plugins and extensions
  • Supports TypeScript out of the box

Cons

  • Learning curve for developers not familiar with Vue.js or component-based frameworks
  • May introduce additional complexity for simple projects
  • Potential performance overhead compared to native WeChat Mini Program development
  • Dependency on third-party framework may lead to compatibility issues with future WeChat Mini Program updates

Code Examples

  1. Creating a component:
<template>
  <view>{{ message }}</view>
</template>

<script>
import wepy from 'wepy'

export default class MyComponent extends wepy.component {
  data = {
    message: 'Hello, WePY!'
  }
}
</script>

<style lang="less">
view {
  color: #333;
}
</style>
  1. Using props and events:
<template>
  <view @tap="handleClick">{{ propMessage }}</view>
</template>

<script>
import wepy from 'wepy'

export default class MyComponent extends wepy.component {
  props = {
    propMessage: String
  }

  methods = {
    handleClick() {
      this.$emit('myEvent', 'Hello from child')
    }
  }
}
</script>
  1. Using mixins:
// mixin.js
export default {
  data: {
    mixin: 'This is mixin data'
  },
  methods: {
    tap() {
      console.log('mixin tap')
    }
  }
}

// MyComponent.wpy
<script>
import wepy from 'wepy'
import mixin from './mixin'

export default class MyComponent extends wepy.component {
  mixins = [mixin]
}
</script>

Getting Started

  1. Install WePY CLI:

    npm install -g @wepy/cli
    
  2. Create a new project:

    wepy init standard my-project
    cd my-project
    
  3. Install dependencies:

    npm install
    
  4. Start development:

    wepy build --watch
    
  5. Open the project in WeChat DevTools and start coding!

Competitor Comparisons

207,677

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

Pros of Vue

  • Larger ecosystem and community support
  • More flexible, can be used for various types of web applications
  • Better documentation and learning resources

Cons of Vue

  • Steeper learning curve for beginners
  • More complex setup for large-scale applications
  • Less optimized for WeChat mini-programs

Code Comparison

Vue:

<template>
  <div>{{ message }}</div>
</template>

<script>
export default {
  data() {
    return {
      message: 'Hello Vue!'
    }
  }
}
</script>

WePY:

<template>
  <view>{{ message }}</view>
</template>

<script>
import wepy from 'wepy'

export default class extends wepy.component {
  data = {
    message: 'Hello WePY!'
  }
}
</script>

Summary

Vue is a more versatile framework suitable for various web applications, while WePY is specifically designed for WeChat mini-programs. Vue offers a larger ecosystem and better documentation, but may have a steeper learning curve. WePY provides a more streamlined experience for WeChat development but has a smaller community and fewer resources. The code structure is similar, with WePY using WeChat-specific elements like <view> instead of <div>.

A framework for building native applications using React

Pros of React Native

  • Larger community and ecosystem, with more third-party libraries and resources
  • Cross-platform development for both iOS and Android
  • Backed by Facebook, ensuring long-term support and updates

Cons of React Native

  • Steeper learning curve, especially for developers new to React
  • Performance can be slower compared to native development
  • Larger app size due to the inclusion of the React Native runtime

Code Comparison

React Native:

import React from 'react';
import { View, Text } from 'react-native';

const App = () => (
  <View>
    <Text>Hello, React Native!</Text>
  </View>
);

WePY:

<template>
  <view>
    <text>Hello, WePY!</text>
  </view>
</template>

<script>
import wepy from 'wepy';
export default class extends wepy.page {
  // Component logic here
}
</script>

Key Differences

  • React Native uses JSX syntax, while WePY uses a Vue-like template structure
  • React Native is designed for mobile app development, whereas WePY is specifically for WeChat mini-programs
  • WePY has a smaller learning curve for developers familiar with Vue.js
  • React Native offers more flexibility and broader application, while WePY is optimized for the WeChat ecosystem
35,461

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

Pros of Taro

  • Supports multiple platforms (Web, React Native, WeChat Mini Program, etc.)
  • Larger community and more active development
  • Better documentation and learning resources

Cons of Taro

  • Steeper learning curve, especially for developers new to React
  • Slightly more complex setup process
  • May have performance overhead due to cross-platform compatibility

Code Comparison

Taro (React-like syntax):

import { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'

export default class Index extends Component {
  render() {
    return (
      <View>
        <Text>Hello, Taro!</Text>
      </View>
    )
  }
}

WePY (Vue-like syntax):

<template>
  <view>
    <text>Hello, WePY!</text>
  </view>
</template>

<script>
import wepy from 'wepy'

export default class Index extends wepy.page {
  // Component logic here
}
</script>

Both frameworks aim to simplify mini-program development, but Taro offers broader platform support and uses React-like syntax, while WePY focuses on WeChat mini-programs with Vue-like syntax. Taro's multi-platform capabilities make it more versatile, but WePY may be easier for developers familiar with Vue. The choice between them often depends on project requirements and developer preferences.

39,886

A cross-platform framework using Vue.js

Pros of uni-app

  • Supports multiple platforms (iOS, Android, Web, etc.) with a single codebase
  • Larger ecosystem with more plugins and components
  • Better documentation and community support

Cons of uni-app

  • Steeper learning curve due to its comprehensive nature
  • May have performance issues on some platforms compared to native development
  • Larger bundle size for small projects

Code Comparison

wepy:

<template>
  <view>{{ message }}</view>
</template>

<script>
import wepy from 'wepy'

export default class MyComponent extends wepy.component {
  data = {
    message: 'Hello, WePY!'
  }
}
</script>

uni-app:

<template>
  <view>{{ message }}</view>
</template>

<script>
export default {
  data() {
    return {
      message: 'Hello, uni-app!'
    }
  }
}
</script>

Both frameworks use a Vue-like syntax, but uni-app follows Vue more closely, while wepy has some unique characteristics. uni-app's approach may be more familiar to developers with Vue experience, potentially easing the transition to mobile app development.

16,243

🌱 React and redux based, lightweight and elm-style framework. (Inspired by elm and choo)

Pros of dva

  • Built on top of popular libraries like Redux and React-Router
  • Supports both React and React Native development
  • Provides a more comprehensive solution for state management and side effects

Cons of dva

  • Steeper learning curve due to its reliance on multiple libraries
  • May be overkill for smaller projects or those not requiring complex state management
  • Less focused on specific platforms compared to wepy's WeChat Mini Program emphasis

Code Comparison

dva example:

import dva from 'dva';

const app = dva();
app.model({
  namespace: 'count',
  state: 0,
  reducers: {
    add(state) { return state + 1 },
  },
});

wepy example:

import wepy from 'wepy';

export default class extends wepy.page {
  data = {
    count: 0
  }
  methods = {
    add() {
      this.count++;
    }
  }
}

dva focuses on a more Redux-like approach with models and reducers, while wepy follows a more Vue-like component structure. dva is better suited for larger applications with complex state management needs, whereas wepy is optimized for WeChat Mini Program development with a simpler learning curve.

18,267

A framework for building Mobile cross-platform UI

Pros of Weex

  • Cross-platform development: Supports iOS, Android, and web
  • Larger community and ecosystem
  • More mature and feature-rich framework

Cons of Weex

  • Steeper learning curve
  • Larger bundle size
  • Less focused on WeChat mini-programs

Code Comparison

Weex component example:

<template>
  <div>
    <text>{{ message }}</text>
  </div>
</template>

<script>
export default {
  data() {
    return {
      message: 'Hello, Weex!'
    }
  }
}
</script>

WePY component example:

<template>
  <view>
    <text>{{ message }}</text>
  </view>
</template>

<script>
import wepy from 'wepy'

export default class MyComponent extends wepy.component {
  data = {
    message: 'Hello, WePY!'
  }
}
</script>

Both frameworks use a Vue-like syntax, but WePY is more tailored for WeChat mini-programs, while Weex focuses on cross-platform development. WePY uses wepy.component for component creation, whereas Weex follows a more standard Vue component structure. The template syntax is similar, with minor differences in element naming (e.g., <div> vs <view>).

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

English | 简体中文

WePY 2 (beta)

npm version travis-ci Github CI Coverage Status Dependency Status

介绍

WePY 资源汇总:awesome-wepy

WePY (发音: /'wepi/)是一款让小程序支持组件化开发的框架,通过预编译的手段让开发者可以选择自己喜欢的开发风格去开发小程序。框架的细节优化,Promise,Async Functions 的引入都是为了能让开发小程序项目变得更加简单,高效。

同时 WePY 也是一款成长中的框架,大量吸收借鉴了一些优化前端工具以及框架的设计理念和思想。如果 WePY 有不足地方,或者你有更好的想法,欢迎提交 ISSUE 或者 PR。

特性:

  • ç±» Vue 开发风格
  • 支持自定义组件开发
  • 支持引入 NPM 包
  • 支持 Promise
  • 支持 ES2015+ 特性,如 Async Functions
  • 支持多种编译器,Less/Sass/Stylus/PostCSS、Babel/Typescript、Pug
  • 支持多种插件处理,文件压缩,图片压缩,内容替换等
  • 支持 Sourcemap,ESLint 等
  • 小程序细节优化,如请求列队,事件优化等

Demo

<style lang="less">
@color: #4D926F;
  .num {
  color: @color;
  }
</style>
<template>
  <div class="container">
    <div class="num" @tap="num++">
      {{num}}
    </div>
    <custom-component></custom-component>
    <vendor-component></vendor-component>
    <div>{{text}}</div>
    <input v-model="text"/>
  </div>
</template>
<config>
{
  usingComponents: {
    customComponent: '@/components/customComponent',
    vendorComponent: 'module:vendorComponent'
  }
}
</config>

<script>
  import wepy from '@wepy/core';

  wepy.page({
    data: {
      num: 0,
      text: 'Hello World',
    },
  });
</script>

安装使用

安装(更新) wepy 命令行工具。

npm install @wepy/cli@next -g

生成开发示例

wepy init standard myproject

安装依赖

cd myproject
npm install

开发实时编译

wepy build --watch

开发者工具导入项目

使用微信开发者工具新建项目,本地开发选择项目根目录,会自动导入项目配置。

哪些小程序是用 WePY 开发的

腾讯疫苗查询小程序、 腾讯翻译君小程序、 腾讯地图小程序、 玩转故宫小程序、 手机充值+、 手机余额查询、 手机流量充值优惠、 友福图书馆(开源)、 素洁商城(开源)、 NewsLite(开源)、 西安找拼车(开源)、 深大的树洞(开源)、 求知微阅读(开源)、 给你的 iPhone X 换个发型、 天天跟我买、 坚橙、 群脱单、 米淘联盟、 帮助圈、 众安保险福利、 阅邻二手书、 趣店招聘、 满熊阅读(开源: 微信小程序、支付宝小程序)、 育儿柚道、 平行进口报价内参、 GitHub 掘金版、 班级群管、 鲜花说小店、 逛人备忘、 英语助手君、 花花百科、 独角兽公司、 爱羽客羽毛球、 斑马小店、 小小羽球、 培恩医学、 农资优选、 公务员朝夕刷题、 七弦琴小助手、 七弦琴大数据、 爽到家小程序、 应用全球排行(开源)、 we 川大(开源)、 聊会儿、 诗词墨客(开源)、 南京邮电大学(开源)

...

交流群

WePY 交流群已满 500 人,请加 gcaufy_helper 好友或者扫码加好友,验证回复 wepy 按照指引进群。

wepy_qr_code

参与贡献

如果你有好的意见或建议,欢迎给我们提 Issues 或 Pull Requests,为提升微信小程序开发体验贡献力量。
详见:CONTRIBUTING.md

腾讯开源激励计划 鼓励开发者的参与和贡献,期待你的加入。

Links

Documentation

Changelog

Contributing

License MIT

NPM DownloadsLast 30 Days