• Stars
    star
    226
  • Rank 176,514 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🖖 轻量级的小程序开发框架。可以渐进接入的小程序开发框架,专注于小程序原生开发,提供更好的工程化、代码复用能力,提高开发效率并改善开发体验。

渐进式小程序开发框架

Travis Status node (scoped with tag, custom registry) License

Github Actions Travis Status

wxa.js

轻量级的渐进式小程序开发框架,专注于小程序原生开发,提供更好的工程化、代码复用能力,提高开发效率并改善开发体验。

极速上手,零配置,可无痛迁移。

框架优势

  • 🖖 极速上手 无额外的学习门槛,可以完全使用原生的小程序语法开发。

  • 🏄 零配置 标准项目无需任何配置,即可运行。

  • 🚈 低成本 超低迁移成本,原生小程序可以马上在 @wxa/cli2 中跑起来。支持原生和 wxa 混杂开发,助力老项目逐步迁移。

  • 🚀 依赖分包算法 自研的依赖分包算法,帮助开发者充分的利用分包空间

  • 依赖分析 自动分析项目依赖,无需手动 copy 三方依赖到项目中。

  • 🐧 全方位 提供小程序开发增强能力,譬如状态管理、表单校验等。

  • 🤖 按需引入 任意第三方工具、组件库,随时安装使用,完美适配 weui, vant-weapp等组件库。

  • 👽 多实例 一次性编译出多个三方项目或其他平台的小程序,如头条小程序。

More detail Documents

更完善的文档

安装使用

使用 yarnnpm 全局安装

npm i -g @wxa/cli2

极速新建项目

wxa2 create

启动开发环境

wxa2 build --watch

开发示例

app.wxa

<script>
import {App} from '@wxa/core';

@App
export default class Main {
    globalData = {
        userInfo: 'Genuifx',
    }
}
</script>

<config>
{
    "pages": [
        "pages/index"
    ]
}
</config>

<style lang="scss">
page {
    width: 100%;
    height: 100%;
}
</style>

pages/index.wxa

<script>
import {Page, Mixins, Debounce} from '@wxa/core';
import fooMixin from '../mixins/foo.js';

//定义页面,添加Mixins
@Page
@Mixins(fooMixin)
export default class Index {
    data = {
        formA: {
            org: 'fintech',
            name: 'wxa'
        }
    }

    async onLoad() {
        console.log('Hello World')    
    }

    // 函数防抖
    @Debounce(300)
    sumbitA(e) {
        console.log('submit success!');
    }
}
</script>

<config>
{
    "navigationBarTitleText": "Hello Wxa"
}
</config>

<template>
    <view class="page">
        Hi, <input type="text" value="{{formA.name}}" />
        <button bindtap="sumbitA">提交</button>
    </view>
</template>

<style lang="scss">
.page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}
</style>

默认导出的方法将会自动调用小程序相应的 PageComponentApp 方法进行注册。

更完善的文档

极速预览小程序

wxa2 cli --action preview

技术特点

wxa 是一个 AOP 框架,主要使用 Decorator(运行时改写,拦截)和预编译实现框架功能。

使用 Decorator 实现了:

  • Fetch 自动防重,自动队列管理的网络请求方法。
  • Router 简洁的 API、预加载特性。
  • Eventbus 跨页面,跨组件交互的简单方案。
  • Mixins 混合,跨页面、跨组件复用逻辑。
  • Diff 增量设置数据。
  • Storage 小程序持久化缓存数据。
  • SessionStorage 应用周期内缓存数据。
  • Lock 防止重复执行函数,前端防重利器。
  • Debounnce 防抖动。

查看详细的 Class Decorators

预编译方面,实现了对小程序项目的依赖解析,利用依赖树对整个项目进行管理,以此为基础适配了npm、单文件开发、云开发、三方开发。开发语法方面支持最新的 ES*语法(包括 Async/Await)、Sass/Scss、Stylus,有需求的话可以适配更多语法。

wxa生态

包名 描述 版本
@wxa/core wxa运行时核心
@wxa/cli2 wxa编译时与命令行工具
@wxa/validate 表单验证、支持自定义校验规则和提示
@wxa/watch watch & computed
@wxa/log 小程序实时日志上报
@wxa/mobx wxa引入mobx
@wxa/redux wxa引入redux
@wxa/plugin-uglifyjs 压缩美化 Javascript 代码
@wxa/plugin-replace 任意字符替换,用于生产测试参数替换
@wxa/plugin-copy 复制指定静态资源
@wxa/plugin-bind-hijack 劫持小程序bind事件插件
@wxa/plugin-minify-wxml wxml 压缩
@wxa/plugin-postcss 自定义需要引入的postcss插件
@wxa/plugin-dependencies-analysis 项目构建后的模块依赖关系、体积大小等信息可视化, 方便分析项目的优化空间。
wxa-vscode vscode 插件。开箱即用,安装完毕你将获得:代码自动填充、格式化; 语法高亮、检查(包括wxml、wxs文件); 代码片段提示; 单文件组件支持

社区微信群

社群二维码过期可联络

邮箱 [email protected][email protected]

项目负责人微信 szyshangzhiyuan (加好友请备注:wxa)

Contributors

Thanks goes to these wonderful people (emoji key):


WZT

💻 🚧

biaodoit

💻 🚧

shangzy

💻 🚧

Min Huang

💻 🚧

lucaszhu

💻 🚧

hughliu

💻 🚧

FlyDaisy

💻 🚧

Zachary Kwan

💻

Alan Zhang

💻

hanzooo

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENSE

MIT

More Repositories

1

DataSphereStudio

DataSphereStudio is a one stop data application development& management portal, covering scenarios including data exchange, desensitization/cleansing, analysis/mining, quality measurement, visualization, and task scheduling.
Java
3,050
star
2

fes.js

Fes.js 是一个基于 Vue 3 好用的前端应用解决方案。以约定、配置化、组件化的设计思想,让用户仅仅关心用组件搭建页面内容。技术曲线平缓,上手也简单。在经过多个项目中打磨后趋于稳定。丰富的 Vue 3 生态 和 Fes.js 插件,让业务开发更加简单快捷~
JavaScript
1,390
star
3

Scriptis

Scriptis is for interactive data analysis with script development(SQL, Pyspark, HiveQL), task submission(Spark, Hive), UDF, function, resource management and intelligent diagnosis.
Vue
806
star
4

Qualitis

Qualitis is a one-stop data quality management platform that supports quality verification, notification, and management for various datasource. It is used to solve various data quality problems caused by data processing. https://github.com/WeBankFinTech/Qualitis
Java
693
star
5

WeDataSphere

WeDataSphere is a financial grade, one-stop big data platform suite.
653
star
6

Prophecis

Prophecis is a one-stop cloud native machine learning platform.
Go
475
star
7

Exchangis

Exchangis is a lightweight,highly extensible data exchange platform that supports data transmission between structured and unstructured heterogeneous data sources
Java
447
star
8

Schedulis

Schedulis is a high performance workflow task scheduling system that supports high availability and multi-tenant financial level features, Linkis computing middleware, and has been integrated into data application development portal DataSphere Studio
Java
387
star
9

Visualis

Visualis is a BI tool for data visualization. It provides financial-grade data visualization capabilities on the basis of data security and permissions, based on the open source project Davinci contributed by CreditEase.
TypeScript
261
star
10

Dockin

微众银行开源的基于私有云的容器平台
209
star
11

WeBank-all-Project

All the project addresses participated and established by WeBank are collected.汇集了微众银行参与和建立的所有项目地址。
202
star
12

DeFiBus

DeFiBus is a decentralized finacial message bus for microservices, provide request/reply, unicast, multi-cast, broadcast, delay-message etc, and also privide service governance capacity and operation tools.
Java
191
star
13

KoalaForm

中后台前端低代码表单
TypeScript
145
star
14

fes-design

Vue3 组件库,Typescirpt 编写,高性能,支持按需引入、国际化、配置主题,适配低代码。
TypeScript
139
star
15

WeTrident

一站式App开发套件,帮助开发者快速开发可正式上线运营的App。
JavaScript
125
star
16

DataSphereStudio-Doc

DataSphereStudio documents.
110
star
17

Streamis

Streaming application development and management system, based on Linkis and DSS, planning to provide the workflow-like graphical drag-and-drop development capability.
Java
103
star
18

Dockin-Installer

Production-grade highly available container platform
Shell
59
star
19

incubator-linkis-doc

incubator-linkis-doc has been migrated to incubator-linkis-website: https://github.com/apache/incubator-linkis-website
40
star
20

Dockin-RM

Dockin container platform resource manager is the core module for application definition and container instance management
Java
40
star
21

Dockin-Ops

dockin ops is a project used to handle the exec request for kubernetes under supervision
Go
37
star
22

wt-console

A lightweight, extendable react-native developer and tester tool
JavaScript
34
star
23

Dockin-CNI

kubernetes cni plugin, support fixed ip
Go
31
star
24

eventmesh-connector-defibus

connector for defibus in eventmesh
Java
8
star
25

wxa-vscode

微信小程序开发助手。开箱即用,安装完毕你将获得:代码自动填充、格式化; 语法高亮、检查(包括wxml、wxs文件); 代码片段提示; 单文件组件支持
TypeScript
8
star
26

TractionWidget

牵引小组件
Vue
7
star
27

react-native-rtext

JavaScript
6
star
28

WeCloudStack

Webank Financial Cloud (native) tech Stack for building cloud (native) applications.
1
star
29

wxa-templates

1
star