@tuhu/dt-weapp
TypeScript icon, indicating that this package has built-in type declarations

1.2.3 • Public • Published

dt-weapp

基于微信小程序文档的 DefinitelyTyped

以下 api 暂时未添加

  1. 设备
    1. 网络状态-调节亮度 | 震动,
    2. 加速度计,
    3. 罗盘
    4. 蓝牙
    5. iBeacon
    6. 屏幕亮度
    7. 用户截屏事件
    8. 震动
    9. 手机联系人
    10. NFC
    11. WI-Fi
  2. 开放接口
    1. 微信运动
    2. 生物认证

使用说明

  1. 参考 src/weapp-test.ts使用示例

Page 中实际案例

interface MyPage extends IPage {}
class MyPage implements IPageClass {
  // ....
}
  1. tsconfig 配置
{
  "compilerOptions": {
    // .....
    "sourceMap": true,
    "inlineSourceMap": true,
    "inlineSources": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    // 以下两项开启Decorator
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "typeRoots": ["./node_modules/@tuhu", "./node_modules/@types"]
  }
}
  1. 事件 [新增 v1.1.0] 示例

节选

  onTouch(
    e: wx.ITouchEvent<{
      x: number;
      y: number;
    }>
  ) {
    const {
      type,
      changedTouches,
      currentTarget,
      timeStamp,
      touches,
      detail,
      target
    } = e;
    const { x, y } = detail;
    touches.forEach(touchEvent => {
      const { clientX, clientY } = touchEvent;
    });
  }

Readme

Keywords

Package Sidebar

Install

npm i @tuhu/dt-weapp

Weekly Downloads

1

Version

1.2.3

License

MIT

Unpacked Size

118 kB

Total Files

7

Last publish

Collaborators

  • wayowe
  • doubleyun
  • landn172