-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Разбивка компонента «Конструктор пиццы» на мелкие компоненты #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В целом все хорошо, жду правки по комментариям.
Были места в которых недочеты были идентичны с теми, что я уже описывал ранее в других файлах, поэтому я не стал дублировать.
@onDoughChange="updateCurrentDough($event)" | ||
/> | ||
|
||
<BuilderSizeSelector | ||
:sizes="sizes" | ||
@onSizeChange="updateCurrentSize($event)" | ||
/> | ||
|
||
<BuilderIngredientsSelector | ||
:sauces="sauces" | ||
:ingredients="ingredients" | ||
@onSauceChange="updateCurrentSauce($event)" | ||
@onCountUpdate="updateIngredientsPrice($event)" | ||
/> | ||
|
||
<BuilderPriceCounter | ||
:total-price="totalPrice" | ||
@onIngredientDrop="updateIngredientsPrice($event)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В таких вызовах, когда у нас в аргумент функции передается $event, его можно не писать
То есть, например @onDoughChange="updateCurrentDough($event)"
будет равносильно @onDoughChange="updateCurrentDough"
classMods: { | ||
type: Array, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Критерий Б3. Нужно задать либо required: true либо default
Для массивов default можно задать вот так
props: {
arr: {
type: Array,
default: () => []
}
}
Ссылка на ишью: vuejs/vue#1032 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
И кстати, я так понимаю этот пропс служит для передачи классов на корневой тег компонента. В таком случае делать пропс не обязательно, на компонент ты можешь повесить обычный class и все будет работать как надо
Ссылка на документацию: https://ru.vuejs.org/v2/guide/class-and-style.html#%D0%98%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D1%81-%D0%BA%D0%BE%D0%BC%D0%BF%D0%BE%D0%BD%D0%B5%D0%BD%D1%82%D0%B0%D0%BC%D0%B8
classMods: { | ||
type: Array, | ||
required: false, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Критерий Б3. Нужно задать либо required: true либо default
Для массивов default можно задать вот так
props: {
arr: {
type: Array,
default: () => []
}
}
Ссылка на ишью: vuejs/vue#1032 (comment)
classMods: { | ||
type: Array, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Критерий Б3. Нужно задать либо required: true либо default
Для массивов default можно задать вот так
props: {
arr: {
type: Array,
default: () => []
}
}
Ссылка на ишью: vuejs/vue#1032 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вот в таком случае уже более уместно использование пропса для передачи классов
:value="value" | ||
:is-checked="isChecked" | ||
:name="name" | ||
@onRadioChange="onSauceChange($event)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У нас есть директива v-model, которую мы можем привязать к какому-то инпуту. RadioButton не исключение, то есть обычному radio мы можем задать директиву v-model. Но эту директиву мы так же можем задать и компоненту, настроив внутри компонента нужные свойства: принимающее значение и emit.
Ссылка на документацию: https://ru.vuejs.org/v2/guide/components-custom-events.html#%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-v-model-%D1%83-%D0%BA%D0%BE%D0%BC%D0%BF%D0%BE%D0%BD%D0%B5%D0%BD%D1%82%D0%B0
({ multiplier: multiplierMap }) => multiplier === multiplierMap | ||
).value, | ||
}, | ||
isChecked: index === 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично в normalizeDoughs
<input | ||
type="radio" | ||
:name="radioName" | ||
:value="value" | ||
:checked="isChecked" | ||
@change="onRadioChange(value)" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У нас есть директива v-model, которую мы можем привязать к какому-то инпуту. RadioButton не исключение, то есть обычному radio мы можем задать директиву v-model. Но эту директиву мы так же можем задать и компоненту, настроив внутри компонента нужные свойства: принимающее значение и emit.
Ссылка на документацию: https://ru.vuejs.org/v2/guide/components-custom-events.html#%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-v-model-%D1%83-%D0%BA%D0%BE%D0%BC%D0%BF%D0%BE%D0%BD%D0%B5%D0%BD%D1%82%D0%B0
const transferData = JSON.parse( | ||
dataTransfer.getData(DATA_TRANSFER_PAYLOAD) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сюда можно передать уже созданную переменную payload
}}</span> | ||
|
||
<AppCounter | ||
:class-mods="['counter--orange', 'ingridients__counter']" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ошибка ingredients
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value: undefined, | ||
}); | ||
}, | ||
|
||
dec() { | ||
this.$emit("onCountUpdate", { | ||
action: countAction.DEC, | ||
value: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По-моему нет никакого смысла использовать value: undefined
. Но если все же нужно передавать пустое значение, то лучше использовать null
…авать снаружи прямо самому компоненту
…value не приходил [object, object]
|
||
computed: { | ||
totalPrice() { | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в расчете стоимости должен учитываться размер
</label> | ||
|
||
<div class="content__constructor"> | ||
<div class="pizza pizza--foundation--big-tomato"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в этом блоке должно отражаться состояние пиццы (в зависимости от настроек теста, соуса, ингридиентов)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Частично - только про пункт 3.7, не так ли?
Про пункт 3.2 этого не сказано, а именно он описывает эту логику
<template> | ||
<div class="counter"> | ||
<button | ||
type="button" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
кнопки должны отключаться когда нельзя уменьшить/увеличить количество ингредиентов
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.2.3 Изменение ингредиентов
В случае если количество ингредиента на пицце равно 3-м, кнопка + становится неактивной, также отключается возможность переноса ингредиента на пиццу.
В случае если количество ингредиента на пицце равно 0, кнопка - становится неактивной.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отсутствует часть функционала по ТЗ.
Часть правок, оставленных на предыдущем ревью, не исправлена
Какая именно часть ТЗ указанного в этом модуле не реализована ? |
По итогу мне надо добавить в расчет учитывание цены при выборе размера пиццы. Если так, то пушу этот фикс. Если нет, то тогда жду пояснений |
Ну, я же об этом не в курсе, в обсуждениях на гитхабе этого нет) |
Согласен) Просто наставник сказал что его не будет и поэтому редиректнул мрчик |
Можно мерджить, думаю |
Done |
🎓 Разбивка компонента «Конструктор пиццы» на мелкие компоненты