.q-card {
display: flex;
flex-direction: column;
-- height: 100%;
++ height: fit-content;
}
.q-card__section {
max-height: full;
overflow: auto;
-- flex-basis: 0;
-- flex-grow: 1;
display: flex;
flex-direction: column;
}
.q-table__container {
overflow: auto;
-- flex-basis: 0;
-- flex-grow: 1;
}
{
path: '/products/:id',
name: 'ProductModal',
component: Categories,// указываем компонент страницы с которой и осуществляется переход
},
<!-- тут условно какие карточки по клику открывают модальное окно -->
<!-- @click="openProduct(product.id)" -->
<vue-final-modal v-if="isModalOpen" @close="closeModal">...</vue-final-modal>
import { ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
const isModalOpen = ref(false);
const currentProductId = ref(null);
const openProduct = (id) => {
currentProductId.value = id;
isModalOpen.value = true;
router.push(`/products/${id}`);
};
const closeModal = () => {
isModalOpen.value = false;
currentProductId.value = null;
router.push('/products'); // Возвращаемся к списку
};
// Отслеживание изменения маршрута
watch(
() => route.params.id,
(id) => {
if (id) {
currentProductId.value = id;
isModalOpen.value = true;
} else {
isModalOpen.value = false;
}
},
{ immediate: true }
);
<template>
<v-app>
<v-container>
<v-stepper v-model="step" :items="items">
<!--...-->
<template v-slot:item.3>
<!-- Последний item-->
<!--...-->
</template>
<template v-slot:next>
<v-btn @click="nextOrSubmit" :disabled="false">
{{ isLastItem ? 'Submit' : 'Next' }}
</v-btn>
</template>
</v-stepper>
</v-container>
</v-app>
</template>
<script setup>
import { ref, reactive, computed } from 'vue'
const items = reactive(['Название и авторы', 'Описания', 'Изображение'])
const step = ref(1)
const isLastItem = computed(() => step.value === items.length)
const nextOrSubmit = () => {
if (isLastItem.value) {
// submit
alert('submit')
return
}
step.value++
}
</script>
addProductToCart(context, {
productId,
colorId,
sizeId,
amount,
}) {
// Тут наверное не лишним будет доп. проверку повесить, раз setTimeout используете, иначе при повторных запросах у вас могут прошлые setTimeout переводить `updateisAddLoadingEnded` в false
++ if (context.state.updateisAddLoadingEnded) return;
context.commit('updateAddLoading', true);
context.commit('updateAddLoadingFailed', false);
context.commit('updateisAddLoadingEnded', false);
return axios.post('url', {
productId: productId,
colorId: colorId,
sizeId: sizeId,
quantity: amount,
}, {
params: {
userAccessKey: context.state.userAccessKey,
},
})
.then((response) => {
context.commit('updateProductsCartData', response.data.items);
context.commit('syncProductsCart');
})
.catch(() => {
-- context.commit('updateAddLoading', false);
context.commit('updateAddLoadingFailed', true);
})
.finally(() => {
context.commit('updateAddLoading', false);
context.commit('updateisAddLoadingEnded', true);
++ setTimeout(() => context.commit('updateisAddLoadingEnded', false), 3000);
});
},
<autocomplete-input
:variants="cargo_codes"
:variantKey="'id'"
:label="'Код груза'"
:variantTitle="'code6'"
v-model="all_information.cargo_code"
-- :class="{ 'error_label': this.telegram_error.cargo_code }"
++ :myClass="{ 'error_label': this.telegram_error.cargo_code }"
></autocomplete-input>
export default {
name: 'AutocompleteInput',
props: {
variants: {
type: Array,
required: true,
},
value: {
default: ''
},
label: {
type: String,
default: '',
},
variantKey: {
type: String,
default: 'id'
},
variantTitle: {
type: String,
default: 'id'
},
placeholder: {
type: String,
default: ''
},
needFull: {
type: Boolean,
default: false
},
-- error_label: {
-- type: String,
-- default: ''
-- }
++ myClass: {
++ type: String,
++ default: {},
++ }
},
<template>
<div class="autocomplite_component">
<div class="controller">
<input type="text" class="textarea" @input="onInput" :value="value" :placeholder="placeholder">
</div>
<br>
-- <label class="label" :class="error_label">{{ label }}</label>
++ <label class="label" :class="myClass">{{ label }}</label>
<div class="variants" v-if="filtered && showVariants" style="max-height: 50px; overflow: auto;">
<div v-for="v in filtered" :key="v[variantKey]" class="variant" @click="selectVariant(v)">
<span style="cursor: pointer;">{{ v[variantTitle] }}</span>
</div>
</div>
</div>
</template>
filteredArray() {
return this.array
.filter((el) => {
return (!this.search.length ? true : (el?.name?.toLowerCase().includes(this.search) ||
el?.surname?.toLowerCase().includes(this.search))) &&
(this.salary === null ? true : el.salary === this.salary) &&
(this.quality === null ? true : el.quality === this.quality) &&
(this.rating === null ? true : el.rating === this.rating && el.mode !== MODES.HIGH) &&
(this.body === null ? true : (this.body === Bodys.CHECKED ? el.workers.some(({ checked }, index) =>
index <= el.workersIds.length - 1 ? !checked : false
)
: el.workers.every(({ checked }, index) =>
index <= el.workersIds.length - 1 ? checked : true
)) )
}).sort((a, b) => {
if (a?.name?.toLowerCase() > b?.name?.toLowerCase()) {
return isDesc ? -1 : 1;
}
if (a?.name?.toLowerCase() < b?.name?.toLowerCase()) {
return isDesc ? 1 : -1;
}
return 0;
});
},