Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【开源自荐】 基于 Vue3 的响应式小程序框架,使用组合式 API (Composition API) 开发小程序 #3150

Open
jaskang opened this issue May 30, 2023 · 0 comments
Labels

Comments

@jaskang
Copy link

jaskang commented May 30, 2023

Rubic

Rubic 是一个轻量级的小程序运行时框架,它继承 Vue3 的设计思路,并提供了与 Vue 一致的编程模型(组合式 API + 响应式 API)。它专注于 javascript 逻辑部分,为小程序提供更好的逻辑复用以及更灵活的代码组织能力。

官方文档
代码仓库

特性

  • 响应性:基于 @vue/reactivity 的响应式能力。
  • 组合式:与 vue3 一致的 Composition API 来描述组件逻辑。
  • 类型化:灵活的 API 和完整的 TypeScript 类型。
  • 轻量级:仅 30KB 的体积,无编译依赖,现有小程序可轻松接入。

示例:

import { definePage, ref, computed } from 'Rubic'

definePage({
  setup(query, ctx) {
    const count = ref(0)
    const double = computed(() => count.value * 2)

    const increment = () => {
      count.value++
    }
    return {
      count,
      double,
      increment,
    }
  },
})
<view bindtap="increment">{{count}} x2:{{double}}</view>
@ruanyf ruanyf added the weekly label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants