44 < meta charset ="UTF-8 ">
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
66 < title > Sorting Visualizer</ title >
7- < link rel ="stylesheet " href ="styles.css ">
7+ <!-- Update CSS path if using Vue CLI/Vite structure -->
8+ < link rel ="stylesheet " href ="src/assets/main.css ">
9+ <!-- Use specific Vue.js version -->
10+ < script src ="https://unpkg.com/vue@3.3.4 "> </ script >
811</ head >
912< body >
10- < div class ="container ">
13+ < div id =" app " class ="container ">
1114 < h1 > Sorting Visualizer</ h1 >
1215
1316 < div class ="input-section ">
1417 < div class ="method-selector ">
1518 < label for ="sortMethod "> Select Sorting Method:</ label >
16- < select id ="sortMethod ">
19+ <!-- Add id attribute to match label -->
20+ < select v-model ="sortMethod " id ="sortMethod ">
1721 < option value ="bubble "> Bubble Sort</ option >
1822 < option value ="insertion "> Insertion Sort</ option >
1923 < option value ="selection "> Selection Sort</ option >
@@ -27,28 +31,37 @@ <h1>Sorting Visualizer</h1>
2731 < div class ="numbers-input ">
2832 < label > Enter 5 Numbers:</ label >
2933 < div class ="input-group ">
30- < input type ="number " class =" number-input " placeholder ="Number 1 ">
31- < input type ="number " class =" number-input " placeholder ="Number 2 ">
32- < input type ="number " class =" number-input " placeholder ="Number 3 ">
33- < input type ="number " class =" number-input " placeholder ="Number 4 ">
34- < input type ="number " class =" number-input " placeholder ="Number 5 ">
34+ < input type ="number " v-model =" numbers[0] " placeholder ="Number 1 " class =" number-input ">
35+ < input type ="number " v-model =" numbers[1] " placeholder ="Number 2 " class =" number-input ">
36+ < input type ="number " v-model =" numbers[2] " placeholder ="Number 3 " class =" number-input ">
37+ < input type ="number " v-model =" numbers[3] " placeholder ="Number 4 " class =" number-input ">
38+ < input type ="number " v-model =" numbers[4] " placeholder ="Number 5 " class =" number-input ">
3539 </ div >
3640 </ div >
3741
38- < button id ="sortButton "> Sort Numbers</ button >
42+ < button @click ="sortNumbers " :disabled ="isLoading ">
43+ {{ isLoading ? 'Sorting...' : 'Sort Numbers' }}
44+ </ button >
3945 </ div >
4046
4147 < div class ="output-section ">
4248 < div class ="steps-container ">
4349 < h2 > Sorting Steps:</ h2 >
44- < div id ="sortingSteps " class ="steps-list "> </ div >
50+ < div class ="steps-list ">
51+ < div v-for ="(step, index) in sortingSteps "
52+ :key ="index "
53+ class ="step-item ">
54+ Step {{ index + 1 }}: {{ step }}
55+ </ div >
56+ </ div >
4557 </ div >
4658 < div class ="result-container ">
4759 < h2 > Final Result:</ h2 >
48- < div id =" sortingResult " class ="result "> </ div >
60+ < div class ="result "> {{ sortingResult }} </ div >
4961 </ div >
5062 </ div >
5163 </ div >
52- < script src ="script.js "> </ script >
64+ <!-- Update script path if using Vue CLI/Vite structure -->
65+ < script src ="src/main.js "> </ script >
5366</ body >
5467</ html >
0 commit comments