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

前端页面初始化列表 #98

Open
haier955 opened this issue Oct 17, 2023 · 0 comments
Open

前端页面初始化列表 #98

haier955 opened this issue Oct 17, 2023 · 0 comments

Comments

@haier955
Copy link

页面初始化列表部分,可以设置请求方式,使得请求获取列表数据方式更灵活
comoents/Crud/crud.js

function CRUD(options) {
  const defaultOptions = {
    tag: 'default',
    // id字段名
    idField: 'id',
    // 标题
    title: '',
    // 请求数据的url
    url: '',
    // 请求方式
    type: '',
    ...

api/data.js

export function initData(url, params, type) {
  if(type == 'POST'){
    return request({
      url: url + '?' + qs.stringify(params, { indices: false }),
      method: 'post',
      params
    })
  }

  return request({
    url: url + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant