NewFuture / miniprogram-network

Redefine the Network API of Wechat MiniProgram (小程序网络库)
https://miniprogram-network.newfuture.cc
Apache License 2.0
113 stars 11 forks source link

调用cacheRequest报错 #45

Closed superlbr closed 3 years ago

superlbr commented 3 years ago

Unhandled promise rejection TypeError: Cannot read property 'request' of undefined

    get(action, data, config) {
        return this.request('GET', action, data, config);
    }
NewFuture commented 3 years ago

不能复现,是怎么调用的?

superlbr commented 3 years ago

那cacheRequest应该怎么调用呢

NewFuture commented 3 years ago

一般就和request一样调用

import { cacheRequest } from "miniprogram-network";
cacheRequest({
  url:  API,
  params: { id },
});

如果只想使用cache不使用其它库可以https://github.com/NewFuture/miniprogram-network/tree/master/cache