Nothing Special   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usePagination 设置额外的defaultParams,分页参数丢失 #222

Open
guangmingcunliutao opened this issue Dec 8, 2023 · 2 comments
Labels
question Further information is requested

Comments

@guangmingcunliutao
Copy link

代码示例

const { pageSize, params } = usePagination(
  ({ current }) => {
    console.log('current', current)
    return getCurrentAppMenusService()
  },
  {
    defaultParams: ['test']
  }
)
console.log('params', params.value)

问题描述 Problem Description

image

当使用usePagination,并且设置额外的defaultParams时,current变为了undefined,想问下是这样设计的还是bug

其他信息 Other information

版本:vue-request@2.0.4
node: v16.15.0
pnpm: 8.10.2
浏览器:360极速x 版本号: 22.1.1056.64 (64位)内核版本: 119.0.6045.160

@guangmingcunliutao guangmingcunliutao added the question Further information is requested label Dec 8, 2023
@John60676
Copy link
Member

defaultParams 的参数至少是要个对象才能给你合并
https://github.com/AttoJS/vue-request/blob/master/src/usePagination.ts#L65

@guangmingcunliutao
Copy link
Author

defaultParams 的参数至少是要个对象才能给你合并 https://github.com/AttoJS/vue-request/blob/master/src/usePagination.ts#L65
image

仔细看了下确实是这样,defaultParams数组的第一位必须是对象,感觉有点怪怪的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants