From 4db90c67dad8e54d44094efca39ebd2ee7f56ffd Mon Sep 17 00:00:00 2001 From: unknown <qq1940665526@163.com> Date: 星期二, 04 六月 2024 15:17:39 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout --- src/components/matching/matching.vue | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/matching/matching.vue b/src/components/matching/matching.vue index a33045c..2ceb837 100644 --- a/src/components/matching/matching.vue +++ b/src/components/matching/matching.vue @@ -1,6 +1,6 @@ <template> - <div class="connect" id="connect" ref="connect" @mouseup="mouseup"> - <div class="answer" @mousemove="mousemove"> + <div class="connect" id="connect" ref="connect" @mousemove="mousemove" @mouseup="(e) => touchend(e)"> + <div class="answer" > <div class="answer-box"> <div class="answer-box-item" @@ -19,7 +19,6 @@ v-for="(item, index) in rightArr" :key="index" ref="right" - @mouseup="(e) => touchend(e, item, index)" > {{ item.label.txt }} </div> @@ -57,6 +56,7 @@ scrollTop: 0, debounce: false, checkItem: null, + checkItemIndex:null }; }, props: { @@ -149,8 +149,8 @@ }); }, // 瑙︽懜缁撴潫 - touchend(e, item, index) { - console.log("鎶捣", e,item); + touchend(e, index) { + console.log("鎶捣", e,this.checkItem); this.isDragging = false; if (this.item.showAnswer) { return false; @@ -164,20 +164,20 @@ this.canvasB.clearRect(0, 0, this.clientWidth, this.clientHeight); // 濡傛灉涓嶆槸鍙宠竟鐨刣om 鐩存帴鎶� 绾� 骞叉帀 -- 璇佹槑涓嶆槸 娌℃湁鎷栧埌鍙宠竟涓� if (!right) { - item.line = []; + this.checkItem.line = []; return; } // 濡傛灉宸叉湁鐨勪笉鏄垜鑷繁 鐩存帴鏇挎崲鎺変笂涓�涓殑 - if (item.value[0] !== right.index) { + if (this.checkItem.value[0] !== right.index) { let model = this.leftArr.find((r) => r.value[0] === right.index); if (model) { model.value = []; model.line = []; } - item.value = [right.index]; + this.checkItem.value = [right.index]; } // 閲嶆柊璧嬪�� 绾跨殑 x y 杞� - item.line = this.attachment(index, right.index); + this.checkItem.line = this.attachment(this.checkItemIndex, right.index); this.drawing(); let model = this.leftArr .map((r, i) => { @@ -187,15 +187,16 @@ }; }) .filter((r) => r.right !== undefined); - this.$emit("input", model); + // this.$emit("input", model); this.item.userChoise = model; - console.log(JSON.stringify(model)); + // console.log(JSON.stringify(model)); }, // 瑙︽懜寮�濮� - touchstart(e, item) { + touchstart(e, item,index) { this.isDragging = true; console.log("鎸変笅", e); this.checkItem = item + this.checkItemIndex = index e.stopPropagation(); // let event = e.targetTouches[0]; item.line = [ @@ -219,11 +220,10 @@ // 绉诲姩涓� mousemove(e) { if (!this.isDragging) return false; - console.log("绉诲姩", e); if (this.item.showAnswer) { return false; } - // let event = e.targetTouches[0]; + console.log('绉诲姩',e); this.checkItem.line[2] = e.pageX; this.checkItem.line[3] = e.pageY - this.$refs.connect.getBoundingClientRect().y + this.scrollTop; -- Gitblit v1.9.1