miniprogram-hooks
小程序自定义组件 hooks 实现。
PS:注意,这是一个试验性的作品,并不是一个成熟的工具,除非你很了解它会带来的问题,不然请不要在生产环境中直接使用。
使用方法
- 安装 miniprogram-hooks:
npm install --save miniprogram-hooks
- 在定义自定义组件时使用
const useState useEffect FunctionalComponent = // 使用函数式的方式声明组件
{{count}}<!-- 参数必须得通过 data-arg 来传入 -->{{title}}update btn text