fix:测试货架组件
							parent
							
								
									b3a7f23d28
								
							
						
					
					
						commit
						96fe27bee6
					
				| @ -0,0 +1,53 @@ | ||||
| <template> | ||||
|   <div class="shelf"> | ||||
|     <div | ||||
|       v-for="(row, rowIndex) in shelfData" | ||||
|       :key="rowIndex" | ||||
|       class="shelf-row" | ||||
|       :style="{ display: 'flex', flexWrap: 'nowrap' ,height: `${ row.height}px`}" | ||||
|     > | ||||
|       <div | ||||
|         v-for="(slot, slotIndex) in row.slots" | ||||
|         :key="slot.id" | ||||
|         class="shelf-slot" | ||||
|         :style="{ width: `${100 / row.slots.length}%` }" | ||||
|       > | ||||
|         {{ slot.item }} | ||||
|       </div> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| export default { | ||||
|   name: 'ShelfDisplay', | ||||
|   props: { | ||||
|     shelfData: { | ||||
|       type: Array, | ||||
|       required: true, | ||||
|     }, | ||||
|   }, | ||||
|   created() { | ||||
|     this.shelfData = this.shelfData.sort((a, b) => a.row - b.row); | ||||
|   } | ||||
| }; | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
| .shelf { | ||||
|   width: 100%; | ||||
|   margin: auto; | ||||
| } | ||||
| 
 | ||||
| .shelf-row { | ||||
|   margin: 0; /* 移除外边距 */ | ||||
|   padding: 0; /* 移除内边距 */ | ||||
| } | ||||
| 
 | ||||
| .shelf-slot { | ||||
|   box-sizing: border-box; | ||||
|   border: 1px solid #ccc; /* Adjust border style as needed */ | ||||
|   padding: 10px; /* Adjust padding as needed */ | ||||
|   text-align: center; /* Center text inside the slot */ | ||||
| } | ||||
| </style> | ||||
					Loading…
					
					
				
		Reference in New Issue