Documentation
Feedback
Guides
Learning Center

Learning Center
Learning Center
Quick View
View in English
This content was migrated from the VTEX Learning Center and is no longer being actively maintained. For the most accurate and up-to-date information, please check the official documentation.

Introdução

Seguiremos os conceitos aprendidos no passo anterior e vamos aprofundar um pouco mais para aprender como construir o comportamento de Quick View em uma prateleira de produtos.

Atividade

  1. Adicione uma prateleira na sua página inicial:

_18
{
_18
"store.home": {
_18
"blocks": [
_18
...
_18
+ "list-context.product-list"
_18
]
_18
},
_18
+ "list-context.product-list": {
_18
+ "blocks": ["product-summary.shelf"],
_18
+ "children": ["slider-layout"]
_18
+ },
_18
+ "product-summary.shelf": {
_18
+ "children": [
_18
+ "product-summary-name",
_18
+ "product-selling-price"
_18
+ ]
_18
+ }
_18
}

  1. No product-summary adicione um trigger para o modal:

_10
{
_10
...
_10
"product-summary.shelf": {
_10
"children": [
_10
+ "modal-trigger#quickview",
_10
"product-summary-name",
_10
"product-selling-price"
_10
]
_10
}
_10
}

  1. Vamos, então, fazer com que o trigger para o modal seja a imagem do produto e definir que usaremos um layout:

_13
{
_13
...
_13
"product-summary.shelf": {
_13
"children": [
_13
"modal-trigger#quickview",
_13
"product-summary-name",
_13
"product-selling-price"
_13
]
_13
},
_13
+ "modal-trigger#quickview": {
_13
+ "children": ["product-summary-image", "modal-layout#quickview"]
_13
+ }
_13
}

  1. Para fechar vamos definir um simples modal com algumas opções de produto:

_12
{
_12
...
_12
+ "modal-layout#quickview": {
_12
+ "children": [
_12
+ "product-summary-name",
_12
+ "product-images",
_12
+ "product-summary-sku-selector",
_12
+ "product-summary-quantity",
_12
+ "add-to-cart-button"
_12
+ ]
_12
+ }
_12
}

O resultado, então, deve ser:

{"base64":"  ","img":{"width":752,"height":484,"type":"gif","mime":"image/gif","wUnits":"px","hUnits":"px","length":4823726,"url":"https://user-images.githubusercontent.com/18701182/90278764-585c3d00-de3e-11ea-8fa9-491a1cfd6001.gif"}}

Answer sheet

See answer sheet for home.jsonc
home.jsonc

_28
{
_28
"store.home": {
_28
"blocks": ["list-context.product-list"]
_28
},
_28
"list-context.product-list": {
_28
"blocks": ["product-summary.shelf"],
_28
"children": ["slider-layout"]
_28
},
_28
"product-summary.shelf": {
_28
"children": [
_28
"modal-trigger#quickview",
_28
"product-summary-name",
_28
"product-selling-price"
_28
]
_28
},
_28
"modal-trigger#quickview": {
_28
"children": ["product-summary-image", "modal-layout#quickview"]
_28
},
_28
"modal-layout#quickview": {
_28
"children": [
_28
"product-summary-name",
_28
"product-images",
_28
"product-summary-sku-selector",
_28
"product-summary-quantity",
_28
"add-to-cart-button"
_28
]
_28
}
_28
}

On this page