D
D
drtvader2018-02-09 13:10:29
Pug
drtvader, 2018-02-09 13:10:29

How to infer from the PUG mixin?

Hey!
There is a large product mixin, with arrays. I can't figure out how to enter data for arrays in each call to such a mixin.
Maybe someone will tell

mixin product-item(notice, name, price, size, old, oldprice, img)
    +b.product-item
        +e.wrapper
            +e.compare
                +e.add.--compare(href="javascript:void(0);" title="")
                    include ui-kit/icon.pug
                    +icon("compare").--product-item
            +e.favorites
                +e.add.--favorites(href="javascript:void(0);" title="")
                    include ui-kit/icon.pug
                    +icon("favorites").--product-item
            if notice == 'vip'
                include ui-kit/label.pug
                +label('vip').--vip
            else if notice == 'hit'
                include ui-kit/label.pug
                +label('хит').--hit
            else if notice == 'new'
                include ui-kit/label.pug
                +label('new').--new
            else if notice == 'sale'
                include ui-kit/label.pug
                +label('%').--sale
            +b.button.--product-quck.js-qick-view(href="javascript:void(0);" title=name) быстрый просмотр
            +e.image-wrapper
                +e.image.js-wrapper-image(src=img, alt=name, title=name)
            +e.color
                include select-color.pug
                //это вывести отдельно
                +select-color("", "#f3e222", "transparent", "#926ca7", "#926ca7", "#7fd0af", "#0bb8b2").--product-item
            +e.info
                +e.name #{name}
                +e.size #{size}
                +e.hidden-info
                    +e.size-change
                        include ui-kit/hr.pug
                        +hr().--product-item
                        include ui-kit/size-list.pug
                        //это вывести отдельно
                        +size-list({'items': [{
                                "textLabel": "XL",
                                "name": "size-105",
                                "id": "size-type-120",
                                "checked": true
                            }, {
                                "textLabel": "L",
                                "name": "size-105",
                                "id": "size-type-121"
                            }, {
                                "textLabel": "M",
                                "name": "size-105",
                                "id": "size-type-122"
                            }, {
                                "textLabel": "S",
                                "name": "size-105",
                                "id": "size-type-123"
                            }
                        ]}).--square.--product-item
                   //это вывести отдельно
                    +characteristic-info({'items': [{
                            'title': 'Ш х В х Г',
                            'definition': '40 x 55 x 20/24 см'
                        },
                        {
                            'title': 'Объем',
                            'definition': '38/43 л'
                        },
                        {
                            'title': 'Масса',
                            'definition': '2,5 кг'
                        }
                    ]}).--product-item
                include ui-kit/price.pug
                +price(price, old, oldprice, ".-").--product-item

Conclusion:
+product-item("vip", "American Tourister Sunset Square Spinner 13G*908", "22 100", 
"Огромный чемодан-спиннер (XL)", "", "oldprice", 
"images/content/announcement-1.jpg")

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question