javascript - The logic of the sorting function of the WeChat mini program e-commerce search page
给我你的怀抱
给我你的怀抱 2017-06-15 09:21:22
0
3
920

Currently developing the business logic of the search page. Since I rarely made interfaces before, the business logic is a bit unclear now. I hope the master can talk about the specific business logic and solve my concerns (such as sales sorting: how to achieve ascending and descending order, do you use variables to control whether the user clicks in ascending or descending order? Do you need to go to the backend request every time you click? One interface?).
The interface documentation is as follows:

给我你的怀抱
给我你的怀抱

reply all (3)
阿神

Every time you want to request the interface from the background, such as sales volume, this changes in real time, and the data may change the next time you request it. For price sorting, if the first time is ascending order and the next time is descending order, when the amount of data is only one page, it can be sorted locally. However, when the amount of data exceeds one page and the rest of the data has not been obtained, the locally sorted data will be wrong. Yes.

    小葫芦

    If you just ask whether you want to go to the backend to request the interface, then the answer is "yes"

      扔个三星炸死你

      When requesting the backend, add order when reading the database. If you only want to sort by a single item, you can add a val to each button and pass it to the backend. The backend will determine what sorting it is and then order to read the database

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!