Giter VIP home page Giter VIP logo

Comments (7)

OCNYang avatar OCNYang commented on May 16, 2024

这是购物车的逻辑,不支持单选的。

from cartlayout.

Yn1025 avatar Yn1025 commented on May 16, 2024

这是购物车的逻辑,不支持单选的。
我看了下源码 想修改成 group 可以单选 可是能力有限 大神能给一点思路吗?

from cartlayout.

Yn1025 avatar Yn1025 commented on May 16, 2024

就是只可以选择一个店铺里面的商品

from cartlayout.

OCNYang avatar OCNYang commented on May 16, 2024

我明白你说的逻辑,但是这个库我是按照普通购物车封装的,如果你有特殊需求,可以下载源码,在源码内拓展逻辑以符合你的需求

from cartlayout.

Yn1025 avatar Yn1025 commented on May 16, 2024

下载了 改乱了都.... 大神有空的话 提供一点思路呗 拜托了.......

from cartlayout.

OCNYang avatar OCNYang commented on May 16, 2024

这个逻辑也很明确:

1. 用一个变量 currentGroup 保存勾选的当前店铺的下标,默认为 -1;
2. 当勾选一个店铺时,判断 currentGroup 的值,不为 -1 时把这个下标的店铺 item 勾选状态改变,然后把当前勾选的店铺下标再赋值给 currentGroup;
3. 当取消勾选店铺时,把 currentGroup 的值重置为-1;
4. 当勾选一个商品时,先获取这个商品所属的店铺下标,和 currentGroup 不等时执行步骤 2 ,相等时不执行任何逻辑;
5. 当取消一个商品时,先判断同店铺下是否还有其他商品是勾选状态,如果没有执行 3 ,如果有不执行任何逻辑;  

目前我只想到这些逻辑应该就可以了。是否有漏洞要靠实践。

from cartlayout.

Yn1025 avatar Yn1025 commented on May 16, 2024

谢谢谢谢 非常感谢

from cartlayout.

Related Issues (6)

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.