alovajs / scene Goto Github PK
View Code? Open in Web Editor NEWrequest strategy with alova.js
Home Page: https://alova.js.org
License: MIT License
request strategy with alova.js
Home Page: https://alova.js.org
License: MIT License
none
1.6.2
I recently updated @alova/scene-vue to 1.6.2
and alova to 3.0.5
, both of which are the latest version as of the posting of this issue.
However, the two packages seems to be incompatible and I got the following error message during building:
x Build failed in 6.90s
error during build:
node_modules/@alova/scene-vue/dist/alova-scene.esm.js (1:17): "getMethodKey" is not exported by "node_modules/alova/dist/alova.esm.js", imported by "node_modules/@alova/scene-vue/dist/alova-scene.esm.js"
npm i @alova/[email protected]
npm i [email protected]
No response
分页 hook reload 函数从cofnig 中获取initialPage页,并重新加载数据,我认为这样更加符合直觉,而不是固定从第一页开始加载。
rt
1.2.1
scene/src/hooks/pagination/usePagination.js
Line 144 in 3e8fae8
No response
无
1.4.2
[Bug Report] 使用 usePagination 的过程中 Method 出现了 error,再次调用 reload 会调用失败
使用 usePagination 的过程中 Method 出现了 error,再次调用 reload 会没有效果
任意
无
1.4.0
const { page, data: dataSource, replace, isLastPage, loading } = usePagination(
(pageNo, pageSize) => IndexApi.deviceManagePage({ pageNo, pageSize, type: type.value}),
{
// 请求前的初始数据(接口返回的数据格式)
initialData: {
total: 0,
list: []
},
data: response => response.list,
initialPage: 1, // 初始页码,默认为1
initialPageSize: 10, // 初始每页数据条数,默认为10
append: true,
watchingStates: [pickerValue],
}
)
第一次请求的参数
pageNo=1&pageSize=10&type=0
第二次请求的参数
pageNo=2&pageSize=10&type=0
(pageNo, pageSize) => {
console.log(pageNo);
return IndexApi.deviceManagePage({ pageNo, pageSize, type: range.value[pickerValue.value].value })
},
No response
2.16.1
No response
No response
1、使用了uniapp 适配器 。
2、使用usePagination
No response
无
1.5.0
在 Taro + React + 微信小程序环境下,引入 useCaptcha
后,报错:can not call useHooks until set the 'statesHook' at alova instance
已经在创建实例的时候使用了 adapter-taro:
// 创建实例
import { createAlova } from 'alova'
import AdapterTaro from '@alova/adapter-taro'
export const user = createAlova({
baseURL: BaseUrl.PROD,
...AdapterTaro(),
})
使用下面代码,在页面渲染阶段就报上面的错:
const getVerifyCode = (params) => user.Post('/verify_code/', params)
const {
loading: sending,
send: sendCaptcha,
countdown,
} = useCaptcha(() => getVerifyCode({ phone }), {
initialCountdown: 60,
})
在 Taro + React + 微信小程序场景下引入
No response
https://github.com/lanhui100/alova-bug.git
1.4.3
使用usePagination hook,data使用回调函数制定为:data: (response) => response.results, 但data类型仍然是method的ts类型
以下是代码示例:
const { data, isLastPage, page, pageSize, pageCount, total, loading, error, onError, onSuccess } = usePagination( (page, pageSize) => getProjectListApi(status.value, client, location.value, page, pageSize), { total: (response) => response.count, data: (response) => response.results, initialData: { total: 0, data: [] }, initialPage: 1, initialPageSize: 10 } )
错误是:data应返回ts类型为Project[], 但实际返回的是method getProjectListApi返回的类型是ProjectPaged:
export interface ProjectPaged { count: number next: string previous: string results: Project[] }
描述如上
Chorme
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.