tinyapp-enhance

0.0.7 • Public • Published

tinyapp-enhance

支付宝小程序

安装

$ npm i tinyapp-enhance

列表

  • 组件监听当前页面的onPageScroll,onShow,onResize,onHide

使用方法

// App.js
import { enhanceApp } from 'tinyapp-enhance'
 
const options = {
  // App的一些配置
}
- App(options)
+ App(enhanceApp(options));
 
// 页面
// Pages/page1/xxx.js
import { enhancePage } from "tinyapp-enhance";
 
const options = {
  // Page的一些配置
}
 
- Page(options);
+ Page(enhancePage(options));
 
// 组件
// Components/xxx-component/xxx.js
import { enhanceComponent } from "tinyapp-enhance";
 
const options = {
+ pageLifetimes: {
+   onPageScroll({ scrollTop }) {
+    // 这里可以访问到使用该组件页面的滚动
+   },
+   onResize(){},
+   onShow(){},
+   onHide(){},
+ }
  // Component 其他配置
}
 
- Component(options);
+ Component(enhanceComponent(options));
 

说明

Readme

Keywords

none

Package Sidebar

Install

npm i tinyapp-enhance

Weekly Downloads

0

Version

0.0.7

License

ISC

Unpacked Size

8.33 kB

Total Files

4

Last publish

Collaborators

  • likun7981