Procházet zdrojové kódy

feat: 解决定制频道序号输入框无法出现的问题

332777428@qq.com před 1 měsícem
rodič
revize
a672c3affd

+ 8 - 21
src/views/operation/channel/detail.vue

@@ -116,28 +116,20 @@
                   <!-- {{ scope.$index + 1 }} -->
                   <!-- {{ scope.row.sort || "" }} -->
                 </span>
+
                 <svg-icon
                   v-if="!disabled && !isRead"
                   icon-class="edit"
                   @click.native="handleEditClick(scope.row, scope.$index)"
                 />
               </div>
-              <!-- 
-              <el-input
-                v-else
-                v-model="scope.row.indexNum"
-                type="number"
-                rows="12"
-                placeholder="序号"
-                @blur="onNumberBlur(scope.row, scope.$index)"
-                @keyup.enter.native="onNumberBlurEnter(scope.row, scope.$index)"
-              /> -->
 
               <!-- ref="numberInput" -->
               <!-- :ref="(el) => (inputRefs[scope.$index] = el)" -->
               <el-input
                 v-else
                 v-model="scope.row.indexNum"
+                @input="handleInput"
                 size="mini"
                 style="width: 60px"
                 type="number"
@@ -202,7 +194,6 @@ export default {
   },
   data() {
     return {
-      inputRefs: [], // 存储 ref 的数组
       editData: {
         currentEditIndex: -1,
         currentEditSort: 1,
@@ -240,19 +231,15 @@ export default {
 
       this.editData.currentEditIndex = index;
       this.editData.currentEditSort = row.indexNum;
-      console.log("safqwerqwr==000==" + row.indexNum + "===" + index);
       this.$nextTick(() => {
-        console.log("safqwerqwr==111==" + row.indexNum + "===" + index);
-        setTimeout(() => {
-          console.log("safqwerqwr==333==" + row.indexNum + "===" + index);
-          this.$refs.numberInput.focus();
-          // this.$refs.numberInput.select();
-        }, 50);
+        this.$refs.numberInput.focus();
+        // this.$refs.numberInput.select();
       });
+    },
 
-      // this.$nextTick(() => {
-      //   this.$refs.numberInput.focus();
-      // });
+    handleInput(value) {
+      this.form.list[this.editData.currentEditIndex].indexNum = value;
+      this.form.list = this.form.list.filter((i) => i);
     },
 
     onNumberBlurEnter(row, index) {

+ 2 - 0
src/views/operation/channels/detail.vue

@@ -131,6 +131,7 @@
                 @keyup.enter.native="onNumberBlurEnter(scope.row, scope.$index)"
               /> -->
 
+
               <el-input
                 v-else
                 v-model="scope.row.indexNum"
@@ -234,6 +235,7 @@ export default {
       this.editData.currentEditSort = row.indexNum;
       this.$nextTick(() => {
         this.$refs.numberInput.focus();
+        // this.$refs.numberInput.select();
       });
     },