wx-miniapp-before-hook
1.0.3 • Public • Published wx-miniapp-before-hook
功能
给微信小程序带来
- 1.给App增加beforeOnLaunch,beforeShow的钩子
- 2.给Page增加beforeOnLoad,beforeShow的钩子
安装
npm install wx-miniapp-before-hook --save
使用
在微信开发者工具中先构建npm生成miniprogram_npm文件夹
import './miniprogram_npm/wx-miniapp-before-hook/index'
App({
beforeOnLaunch(e, next) {
console.log(e)
next()
},
onLaunch(e) {
},
async beforeShow(e, next) {
console.log(e)
next()
},
onShow(e) {
}
})
import { checkLogin } from './common/login'
Page({
beforeOnLoad(e, next) {
console.log(e)
next()
},
onLoad(e) {
},
async beforeShow(next) {
await checkLogin()
next()
},
onShow() {
}
})
Package Sidebar
Install
npm i wx-miniapp-before-hook
Weekly Downloads