前情提要:
https://developers.weixin.qq.com/community/minihome/doc/0000c0a90303f874e633df39861000
首先如上,是Component()链式调用没有类型提示,完全不知道哪些是支持的,哪些又不支持;
然后如题,链式调用中使用Computed的behavior,会报错如下:
import {
behavior as computedBehavior
} from 'miniprogram-computed'
Component()
.behavior(computedBehavior)
.data(() => ({
windowInfo: wx.getWindowInfo(),
}))
.pageLifetime('resize', function () {
this.setData({
windowInfo: wx.getWindowInfo(),
})
})
.register();
俺寻思官方文档说可以这样写的吧:
还是说事实上Computed这个项目已经被官方放弃更新了?压灭咯,不要放弃啊官方酱。
computed 文档上有专门的 Chaining API 章节,请参考:
https://github.com/wechat-miniprogram/computed/?tab=readme-ov-file#glass-easel-chaining-api-%E6%94%AF%E6%8C%81