我也是,真机调试,getApp()返回undefined ,用的ts语言, 反复尝试,用js可以得到,ts总是会出问题,一开始官方向导生成的模板,直接运行,也是返回undeined
在appt.ts中的globalData中加了属性,编译就出错?[图片] 错误日志: VM3431:1 miniprogram/app.ts:4:5 - error TS2322: Type '{ phone: null; }' is not assignable to type '{ userInfo?: UserInfo | undefined; }'. Object literal may only specify known properties, and 'phone' does not exist in type '{ userInfo?: UserInfo | undefined; }'. 4 phone:null, ~~~~~~~~~~ typings/index.d.ts:4:3 4 globalData: { ~~~~~~~~~~ The expected type comes from property 'globalData' which is declared here on type 'Options<IAppOption>' Found 1 error. VM3396:1 npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! miniprogram-ts-quickstart@1.0.0 tsc: `node ./node_modules/typescript/lib/tsc.js` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the miniprogram-ts-quickstart@1.0.0 tsc script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. console.error @ VM3396:1 (anonymous) @ VM3432:1 VM3396:1 执行自定义预览前预处理命令失败! console.error @ VM3396:1 (anonymous) @ VM3433:1 VM3396:1 npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-03-23T05_00_40_141Z-debug.log
2022-01-05https://developers.weixin.qq.com/miniprogram/dev/extended/weui/slideview.html 为什么这个文档地址404了呢??
Slideview组件左滑出来的按钮,怎么给指定按钮添加点击事件?[图片] 官方文档写的有个属性bindbuttontap,可以添加点击事件,但是没有办法知道点击的是三个按钮中的哪一个。 文档上的说明是:buttons按钮组点击时触发的事件,detail为{index, item},item是按钮的配置项,但这又是什么意思? 文档地址:https://developers.weixin.qq.com/miniprogram/dev/extended/weui/slideview.html
2021-12-17