const showImagesCount = function () {
let maxImagesCount
window.innerWidth < 780 ? maxImagesCount = 3 : maxImagesCount = 4
$('.img-wrapper').each(function () {
const imagesCount = $(this).find('.item-img').length
if(imagesCount > maxImagesCount){
maxImagesCount === 4 ? $(this).find('img').slice(3).remove() : $(this).find('img').slice(2).remove()
$(this).append('<div class="white-block"><span>+' + (imagesCount - maxImagesCount + 1) + '</span></div>')
}
});
}
showImagesCount()
$(window).resize(showImagesCount)
const pending = ref()
...
const changeTab = async (activeName: TabName, oldActiveNameb: TabName) => {
if (!firstTab.value.isDataChanged()) {
changeDialogVisible()
return await pending.value
}
...
handleActiveTab()
}
const handleActiveTab = () => {
previousTab.value = activeTab.value
}
let discardChanges = () => {
firstTab.value.setPreviousData()
...
changeDialogVisible()
}
const changeDialogVisible = () => {
isDialogShown.value = !isDialogShown.value
pending.value = new Promise((resolve) => {
discardChanges = () => resolve(false)
saveChanges = () => resolve(true)
})
}
const hideSymbol = (object: keyof typeof formData, key: keyof typeof object) => {
formData[object][key] = formData[object][key].slice(0, -2)
}