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/chapter005.vue | 110 ++++++++++++++++++++---------------------------------- 1 files changed, 41 insertions(+), 69 deletions(-) diff --git a/src/books/lifeCare/view/chapter005.vue b/src/books/lifeCare/view/chapter005.vue index 7d84fab..44c2af2 100644 --- a/src/books/lifeCare/view/chapter005.vue +++ b/src/books/lifeCare/view/chapter005.vue @@ -191,8 +191,8 @@ :style="{ width: index == 0 || - index == chapter005.tableData151.length - 1 - ? '100px' + index == chapter005.headersData.length - 1 + ? '150px' : '', }" v-for="(header, index) in chapter005.headersData" @@ -209,23 +209,20 @@ > <td v-for="(cell, cellIndex) in row" :key="cellIndex"> <template v-if="cell === ''"> - <input - type="text" - v-model="chapter005.tableData151[rowIndex][cellIndex]" - @blur=" - updateCell(rowIndex, cellIndex, $event.target.value) - " - /> + <div + contenteditable + @blur="updateCell(rowIndex, cellIndex, $event)" + > + {{ chapter005.tableData151[rowIndex][cellIndex] }} + </div> </template> <template v-else> - <input - :readonly="cellIndex == 0" - type="text" - :value="chapter005.tableData151[rowIndex][cellIndex]" - @blur=" - updateCell(rowIndex, cellIndex, $event.target.value) - " - /> + <div + :contenteditable="cellIndex != 0" + @blur="updateCell(rowIndex, cellIndex, $event)" + > + {{ chapter005.tableData151[rowIndex][cellIndex] }} + </div> </template> </td> </tr> @@ -627,10 +624,7 @@ <tr> <th :style="{ - width: - index == 1 || index == chapter005.groupData.length - 1 - ? '100px' - : '', + width: index == 3 ? '300px' : '50px', }" v-for="(header, index) in chapter005.publicHeader" :key="index" @@ -1156,11 +1150,7 @@ <tr> <th :style="{ - width: - index == 1 || - index == chapter005.scoreData1.length - 1 - ? '100px' - : '', + width: index == 3 ? '300px' : '50px', }" v-for="(header, index) in chapter005.publicHeader" :key="index" @@ -1392,11 +1382,11 @@ <p>椁愬墠鏁欒偛鐨勬敞鎰忎簨椤规槸浠�涔堬紵</p> <div class="bk-tx"> <textarea - v-model="chapter005.textAreaItem.text28" + v-model="chapter005.textAreaItem.text228" style="border: 0" placeholder="璇疯緭鍏ュ唴瀹�" rows="5" - @blur="onBlurChange('text28')" + @blur="onBlurChange('text228')" ></textarea> </div> <h3 id="c017"> @@ -1482,30 +1472,20 @@ > <td v-for="(cell, cellIndex) in row" :key="cellIndex"> <template v-if="cell === ''"> - <input - type="text" - v-model="chapter005.tableData155[rowIndex][cellIndex]" - @blur=" - updateCell155( - rowIndex, - cellIndex, - $event.target.value - ) - " - /> + <div + contenteditable + @blur="updateCell155(rowIndex, cellIndex, $event)" + > + {{ chapter005.tableData155[rowIndex][cellIndex] }} + </div> </template> <template v-else> - <input - type="text" - :value="chapter005.tableData155[rowIndex][cellIndex]" - @blur=" - updateCell155( - rowIndex, - cellIndex, - $event.target.value - ) - " - /> + <div + contenteditable + @blur="updateCell155(rowIndex, cellIndex, $event)" + > + {{ chapter005.tableData155[rowIndex][cellIndex] }} + </div> </template> </td> </tr> @@ -1666,11 +1646,7 @@ <tr> <th :style="{ - width: - index == 1 || - index == chapter005.scoreData2.length - 1 - ? '100px' - : '', + width: index == 3 ? '300px' : '50px', }" v-for="(header, index) in chapter005.publicHeader" :key="index" @@ -1838,11 +1814,7 @@ <tr> <th :style="{ - width: - index == 1 || - index == chapter005.scoreData3.length - 1 - ? '100px' - : '', + width: index == 3 ? '300px' : '50px', }" v-for="(header, index) in chapter005.publicHeader" :key="index" @@ -2171,11 +2143,7 @@ <tr> <th :style="{ - width: - index == 1 || - index == chapter005.scoreData4.length - 1 - ? '100px' - : '', + width: index == 3 ? '300px' : '50px', }" v-for="(header, index) in chapter005.publicHeader" :key="index" @@ -3684,9 +3652,9 @@ } localStorage.setItem("chapter005", JSON.stringify(this.chapter005)); }, - updateCell(rowIndex, cellIndex, value) { + updateCell(rowIndex, cellIndex, e) { // 鏇存柊鍗曞厓鏍兼暟鎹� - this.$set(this.chapter005.tableData151[rowIndex], cellIndex, value); + this.$set(this.chapter005.tableData151[rowIndex], cellIndex, e.target.innerText); localStorage.setItem("chapter005", JSON.stringify(this.chapter005)); }, updateCell152(rowIndex, cellIndex, value) { @@ -3704,9 +3672,13 @@ this.$set(this.chapter005.tableData154[rowIndex], cellIndex, value); localStorage.setItem("chapter005", JSON.stringify(this.chapter005)); }, - updateCell155(rowIndex, cellIndex, value) { + updateCell155(rowIndex, cellIndex, e) { // 鏇存柊鍗曞厓鏍兼暟鎹� - this.$set(this.chapter005.tableData155[rowIndex], cellIndex, value); + this.$set( + this.chapter005.tableData155[rowIndex], + cellIndex, + e.target.innerText + ); localStorage.setItem("chapter005", JSON.stringify(this.chapter005)); }, updateCell156(rowIndex, cellIndex, value) { -- Gitblit v1.9.1