Przeglądaj źródła

加载动画优化

黄琪勇 10 miesięcy temu
rodzic
commit
0e3d69b52c
1 zmienionych plików z 6 dodań i 6 usunięć
  1. 6 6
      src/view/music-score/index.tsx

+ 6 - 6
src/view/music-score/index.tsx

@@ -211,16 +211,16 @@ export default defineComponent({
 
 		/** 刷新曲谱 */
 		const refreshMusicScore = () => {
+			const container = document.getElementById('musicAndSelection'), svgDom = document.getElementById('osmdCanvasPage1'), selectionBox = document.getElementById('selectionBox'), selectionBgBox = document.getElementById('selectionBgBox');
+			if (container) {
+				svgDom && container?.removeChild(svgDom)
+				selectionBox && container?.removeChild(selectionBox)
+				selectionBgBox && container?.removeChild(selectionBgBox)
+			}
 			// 有可能会有 其他地方的js执行 阻塞 这里下一帧再执行确保加载条出来
 			requestAnimationFrame(() =>{
 				isLoadingCss.value = true
 				requestAnimationFrame(async () => {
-					const container = document.getElementById('musicAndSelection'), svgDom = document.getElementById('osmdCanvasPage1'), selectionBox = document.getElementById('selectionBox'), selectionBgBox = document.getElementById('selectionBgBox');
-					if (container) {
-						svgDom && container?.removeChild(svgDom)
-						selectionBox && container?.removeChild(selectionBox)
-						selectionBgBox && container?.removeChild(selectionBgBox)
-					}
 					state.evXmlBeginArr = [];
 					state.vfmeasures = [];
 					musicData.showSelection = false;