<!-- 遮罩层 --> <div class='container'> <div v-if='loading' class='overlay'> <div class='loading-spinner'> </div> </div> </div>//控制
loading: false,<style scoped> btn { width: 77px; display: flex; justify-content: space-evenly; margin-top: 10px; } .container { position: relative; } .overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; z-index: 9999; } .loading-spinner { width: 50px; height: 50px; border: 5px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } </style>