Selaa lähdekoodia

选段播放时候 删除第一个标记的时候 全部删除

黄琪勇 1 vuosi sitten
vanhempi
commit
af5e8cb0eb
1 muutettua tiedostoa jossa 20 lisäystä ja 3 poistoa
  1. 20 3
      src/view/selection/index.tsx

+ 20 - 3
src/view/selection/index.tsx

@@ -4,7 +4,7 @@ import styles from "./index.module.less";
 import { metronomeData } from "/src/helpers/metronome";
 import { evaluatingData } from "../evaluating";
 import { leveByScoreMeasureIcons } from "../evaluating/evaluatResult";
-import { Icon } from "vant";
+import { Icon, showToast } from "vant";
 import MoveMusicScore, { moveData, renderForMoveData } from "../plugins/move-music-score";
 import { useRoute } from "vue-router";
 import { getQuery } from "/src/utils/queryString";
@@ -310,8 +310,25 @@ export default defineComponent({
 						return (
 							item && <div class={styles.selectBox} style={item}>
 								<div class={[styles.selectHandle,index>0&&styles.selectHandleRight,state.playState==="play"&&styles.playIng]} onClick={()=>{
-									state.section.splice(index,1)
-									state.section = [...state.section]  // 触发 watch
+									// 如果选择了2个 删除左边的时候
+									if(state.section.length===2&&index === 0){
+										state.section = []
+										showToast({
+											message: "请选择开始小节",
+											duration: 0,
+											position: "top",
+											className: "selectionToast",
+										});
+									}else{
+										state.section.splice(index,1)
+										state.section = [...state.section]  // 触发 watch
+										showToast({
+											message: state.section.length?"请选择结束小节":"请选择开始小节",
+											duration: 0,
+											position: "top",
+											className: "selectionToast",
+										});
+									}
 								}}></div>
 							</div>
 						)