Update vehicle.vue

This commit is contained in:
Sneha 2023-12-18 14:02:59 +05:30
parent aa69a2c782
commit bdf154b81a

View file

@ -225,6 +225,11 @@ export default {
watch: { watch: {
async selectedYear(year) { async selectedYear(year) {
this.makeOptions = [];
this.selectedMake = null;
this.selectedModel = null;
this.selectedStyle = null;
this.carId = null;
if (year) { if (year) {
const result = await this.getMakeOptions(year); const result = await this.getMakeOptions(year);
if (this.selectedYear == year) { if (this.selectedYear == year) {
@ -236,15 +241,13 @@ export default {
this.carId = null; this.carId = null;
} }
} }
} else {
this.makeOptions = [];
this.selectedMake = null;
this.selectedModel = null;
this.selectedStyle = null;
this.carId = null;
} }
}, },
async selectedMake(make) { async selectedMake(make) {
this.modelOptions = [];
this.selectedModel = null;
this.selectedStyle = null;
this.carId = null;
if (make) { if (make) {
const result = await this.getModelOptions(this.selectedYear, make); const result = await this.getModelOptions(this.selectedYear, make);
if (this.selectedMake == make) { if (this.selectedMake == make) {
@ -256,14 +259,12 @@ export default {
this.carId = null; this.carId = null;
} }
} }
} else {
this.modelOptions = [];
this.selectedModel = null;
this.selectedStyle = null;
this.carId = null;
} }
}, },
async selectedModel(model) { async selectedModel(model) {
this.styleOptions = [];
this.selectedStyle = null;
this.carId = null;
if (model) { if (model) {
const result = await this.getStyleOptions( const result = await this.getStyleOptions(
this.selectedYear, this.selectedYear,
@ -283,10 +284,6 @@ export default {
this.carId = null; this.carId = null;
} }
} }
} else {
this.styleOptions = [];
this.selectedStyle = null;
this.carId = null;
} }
}, },
async selectedStyle(style) { async selectedStyle(style) {