a python vesion vue/reactivity api
Project description
仿制VUE reactivity
目前仅支持自定义类和字符串、数字,无法监听数组等的变化,需要大佬帮助。
Usage
from reactivity import *
ref
effect(lambda: (print(v.value)))
v = ref(0)
v.value += 1 # 会自动触发注册的effect函数
reactive
@dataclass
class Person:
name: str
age: int
effect(lambda: (print(obj.name) if obj.age else None))
obj = reactive(Person('wei', 21))
obj.name = 'waa' # 会自动触发注册的effect函数
参考
https://www.vuemastery.com/courses/vue3-deep-dive-with-evan-you/vue3-overview/
https://www.vuemastery.com/courses/vue-3-reactivity/vue3-reactivity
https://github.com/cuixiaorui/mini-vue/tree/master/packages/reactivity/src
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
reactivity-0.0.1.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for reactivity-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca68745dce728ad3cd4ada860b390a491c0cf38261a2983ffaf18c51cf004356 |
|
MD5 | 082bc0c4b6c60ed4f5e3d1d4b9641713 |
|
BLAKE2b-256 | 1e7e08507b4f6b6f05793084c9148bbd9b9c1bb5109d9909ed7a632a6924ced3 |