| | |
| | | > |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="问题文本" prop="questiontext"> |
| | | <el-form-item label="问题文本" prop="questionText"> |
| | | <el-input |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请输入内容" |
| | | id="questiontext" |
| | | id="questionText" |
| | | v-model.sync="indexform.questionText" |
| | | @focus="handleInput('questiontext')" |
| | | @focus="handleInput('questionText')" |
| | | maxlength="30" |
| | | /> |
| | | </el-form-item> </el-col |
| | |
| | | let inputValueArr = ""; |
| | | let el = document.querySelector("#" + this.currentInputId); |
| | | //el.selectionStart; 这就是当前光标所在的位置(字符串中字符的index) |
| | | if (this.currentInputId == "questiontext") { |
| | | inputValueArr = this.indexform.questiontext.split(""); |
| | | if (this.currentInputId == "questionText") { |
| | | inputValueArr = this.indexform.questionText.split(""); |
| | | } else if (this.currentInputId == "nomatchtext") { |
| | | inputValueArr = this.indexform.nomatchtext.split(""); |
| | | } else if (this.currentInputId == "sliencetext") { |
| | |
| | | // 把数组重新转换为字符串并赋值 |
| | | inputValueArr = inputValueArr.join(""); |
| | | console.log(inputValueArr); |
| | | if (this.currentInputId == "questiontext") { |
| | | if (this.currentInputId == "questionText") { |
| | | this.indexform.questionText = inputValueArr; |
| | | } else if (this.currentInputId == "nomatchtext") { |
| | | this.indexform.nomatchtext = inputValueArr; |