Giter Site home page Giter Site logo

Comments (5)

zollero avatar zollero commented on May 24, 2024

@changming1987117 详细说下情况吧

from el-search-table-pagination.

changming1987117 avatar changming1987117 commented on May 24, 2024

我现在后台返回的时候list和total是异步返回来的,因为total很大,为了体验问题,list和total是两个接口返回来的
我只会这样写fetch
fetch(params){
return new Promise(resolve => {
return resolve(API.getTaskList(params));
})
}
这样写的时候,貌似list和total一起返回才可以,
所以想请教下,异步的情况下是怎么写fetch,忘不吝赐教

from el-search-table-pagination.

zollero avatar zollero commented on May 24, 2024

你可以用promise把两个异步加载封装到一个promise里面,然后传给 fetch 属性。 https://github.com/zollero/el-search-table-pagination/blob/master/docs/zh_CN.md#%E5%B1%9E%E6%80%A7

image

from el-search-table-pagination.

zollero avatar zollero commented on May 24, 2024

示例如下:

function getData() {
  return new Promise((resolve, reject) => {
    Promise.all(
      // 这里用两个promise来获取list和total,然后封装在一起
    )
  })
}

from el-search-table-pagination.

changming1987117 avatar changming1987117 commented on May 24, 2024

非常感谢大神的回复,这种写法也是要等两个promise都执行完才会渲染表格数据吧,我希望的是任意一个执行完就开始渲染,因为count计算非常耗时,所以希望可以先把一页的数据展示出来,而不是等待count执行完毕才开始渲染表格,请问这样可以做到吗?

from el-search-table-pagination.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.