From eeff64f494ed72d8acaa13d653c9f3ee181ac950 Mon Sep 17 00:00:00 2001 From: unknown <qq1940665526@163.com> Date: 星期五, 07 六月 2024 16:09:46 +0800 Subject: [PATCH] 优化 --- src/books/lifeCare/view/chapter002.vue | 122 ++++++++++++++++++++++++---------------- 1 files changed, 72 insertions(+), 50 deletions(-) diff --git a/src/books/lifeCare/view/chapter002.vue b/src/books/lifeCare/view/chapter002.vue index bd24f43..b76cf27 100644 --- a/src/books/lifeCare/view/chapter002.vue +++ b/src/books/lifeCare/view/chapter002.vue @@ -1,3 +1,4 @@ +<!-- eslint-disable no-irregular-whitespace --> <template> <div class="chapter" num="3"> <div class="page-box" page="19"> @@ -426,8 +427,8 @@ index == 0 || index == chapter002.headersData.length - 2 || index == chapter002.headersData.length - 1 - ? '100px' - : '', + ? '120px' + : '40px', }" v-for="(header, index) in chapter002.headersData" :key="index" @@ -443,23 +444,20 @@ > <td v-for="(cell, cellIndex) in row" :key="cellIndex"> <template v-if="cell === ''"> - <input - type="text" - v-model="chapter002.tableData121[rowIndex][cellIndex]" - @blur=" - updateCell(rowIndex, cellIndex, $event.target.value) - " - /> + <div + contenteditable + @blur="updateCell(rowIndex, cellIndex, $event)" + > + {{ chapter002.tableData121[rowIndex][cellIndex] }} + </div> </template> <template v-else> - <input - :readonly="cellIndex == 0" - type="text" - :value="chapter002.tableData121[rowIndex][cellIndex]" - @blur=" - updateCell(rowIndex, cellIndex, $event.target.value) - " - /> + <div + :contenteditable="cellIndex != 0" + @blur="updateCell(rowIndex, cellIndex, $event)" + > + {{ chapter002.tableData121[rowIndex][cellIndex] }} + </div> </template> </td> </tr> @@ -767,8 +765,8 @@ <table class="table111 table122"> <thead> <tr> - <th rowspan="3">鏃ユ湡</th> - <th rowspan="3">濮撳悕</th> + <th rowspan="3" style="width: 55px">鏃ユ湡</th> + <th rowspan="3" style="width: 55px">濮撳悕</th> <th colspan="3">鏅ㄩ棿妫�鏌ユ儏鍐�</th> <th colspan="8">鍏ㄦ棩瑙傚療鎯呭喌</th> <th colspan="2">浜ょ彮</th> @@ -801,22 +799,20 @@ > <td v-for="(cell, cellIndex) in row" :key="cellIndex"> <template v-if="cell === ''"> - <input - type="text" - :value="chapter002.tableData122[rowIndex][cellIndex]" - @blur=" - updateCell122(rowIndex, cellIndex, $event.target.value) - " - /> + <div + contenteditable + @blur="updateCell122(rowIndex, cellIndex, $event)" + > + {{ chapter002.tableData122[rowIndex][cellIndex] }} + </div> </template> <template v-else> - <input - type="text" - :value="chapter002.tableData122[rowIndex][cellIndex]" - @blur=" - updateCell122(rowIndex, cellIndex, $event.target.value) - " - /> + <div + contenteditable + @blur="updateCell122(rowIndex, cellIndex, $event)" + > + {{ chapter002.tableData122[rowIndex][cellIndex] }} + </div> </template> </td> </tr> @@ -893,22 +889,24 @@ > <td v-for="(cell, cellIndex) in row" :key="cellIndex"> <template v-if="cell === ''"> - <input - type="text" - v-model="chapter002.tableData123[rowIndex][cellIndex]" + <div + contenteditable @blur=" updateCell123(rowIndex, cellIndex, $event.target.value) " - /> + > + {{ chapter002.tableData123[rowIndex][cellIndex] }} + </div> </template> <template v-else> - <input - type="text" - :value="cell" + <div + contenteditable @blur=" updateCell123(rowIndex, cellIndex, $event.target.value) " - /> + > + {{ cell }} + </div> </template> </td> </tr> @@ -1693,24 +1691,40 @@ this.chapter002.isInspectOpen = !this.chapter002.isInspectOpen; localStorage.setItem("chapter002", JSON.stringify(this.chapter002)); }, - updateCell(rowIndex, cellIndex, value) { + updateCell(rowIndex, cellIndex, e) { // 鏇存柊鍗曞厓鏍兼暟鎹� - this.$set(this.chapter002.tableData121[rowIndex], cellIndex, value); + this.$set( + this.chapter002.tableData121[rowIndex], + cellIndex, + e.target.innerText + ); localStorage.setItem("chapter002", JSON.stringify(this.chapter002)); }, - updateCell122(rowIndex, cellIndex, value) { + updateCell122(rowIndex, cellIndex, e) { // 鏇存柊鍗曞厓鏍兼暟鎹� - this.$set(this.chapter002.tableData122[rowIndex], cellIndex, value); + this.$set( + this.chapter002.tableData122[rowIndex], + cellIndex, + e.target.innerText + ); localStorage.setItem("chapter002", JSON.stringify(this.chapter002)); }, - updateCell123(rowIndex, cellIndex, value) { + updateCell123(rowIndex, cellIndex, e) { // 鏇存柊鍗曞厓鏍兼暟鎹� - this.$set(this.chapter002.tableData123[rowIndex], cellIndex, value); + this.$set( + this.chapter002.tableData123[rowIndex], + cellIndex, + e.target.innerText + ); localStorage.setItem("chapter002", JSON.stringify(this.chapter002)); }, updateCellGroup(rowIndex, cellIndex, value) { // 鏇存柊鍗曞厓鏍兼暟鎹� - this.$set(this.chapter002.groupData[rowIndex], cellIndex, value); + this.$set( + this.chapter002.groupData[rowIndex], + cellIndex, + value + ); if (cellIndex == 4) { this.$set( this.chapter002.groupData[rowIndex], @@ -1723,7 +1737,11 @@ }, updateCellDesign(rowIndex, cellIndex, value) { // 鏇存柊鍗曞厓鏍兼暟鎹� - this.$set(this.chapter002.designData[rowIndex], cellIndex, value); + this.$set( + this.chapter002.designData[rowIndex], + cellIndex, + value + ); if (cellIndex == 4) { this.$set( this.chapter002.designData[rowIndex], @@ -1736,7 +1754,11 @@ }, updateCellInspect(rowIndex, cellIndex, value) { // 鏇存柊鍗曞厓鏍兼暟鎹� - this.$set(this.chapter002.inspectData[rowIndex], cellIndex, value); + this.$set( + this.chapter002.inspectData[rowIndex], + cellIndex, + value + ); if (cellIndex == 4) { this.$set( this.chapter002.inspectData[rowIndex], -- Gitblit v1.9.1