網站首頁 編程語言 正文
?如果加了autofocus還是無效,那么可以用以下方法
<el-input
v-model="patientId"
placeholder=""
autofocus
ref="input1"
></el-input>
注意如果使用ref使用動態id,那么 :ref="id"
// 在需要獲取焦點的地方
var that = this;
this.$nextTick(() => {
that.$refs['input1'].focus();
});
如果refs使用動態的id,那么修改為that.$refs[id].focus();
下面是我使用時代碼?
<div >
<el-input v-if="scope.row.ModelSquare==true" @blur="ModelSquareClose(scope.$index,scope.row.id,scope.row.square)" v-model="scope.row.square" class="inp_dz" autofocus=true :ref="scope.row.id" size=small>
<span slot="suffix" class="span_suf">㎡</span>
</el-input>
<i v-else class="el-icon-edit-outline blue_color" @click="ModelSquareEdit(scope.$index,scope.row.id)"></i>
</div>
ModelSquareEdit(index, id) {
//input出現
console.log(id, 'id');
if (this.AuditList.length > 0) {
this.AuditList[index].ModelSquare = true;
}
// this.AuditQuoteList[index1].list[index2].ModelCheck2 = true;
this.$forceUpdate();
if (this.timer2) {
clearTimeout(this.timer2);
}
var that = this;
this.$nextTick(() => {
that.$refs[id].focus();
});
},
ModelSquareClose(index, id, square) {
//input消失關閉
if (this.AuditList.length > 0) {
this.AuditList[index].ModelSquare = false;
}
if (square) {
this.updateSquareClick(id, square);
} else {
this.get_audit_detail();
}
this.$forceUpdate();
},
原文鏈接:https://blog.csdn.net/weixin_43923808/article/details/131222634
- 上一篇:沒有了
- 下一篇:沒有了
相關推薦
- 2023-03-30 C語言楊氏矩陣簡單實現方法_C 語言
- 2022-03-30 python生成密碼字典詳解_python
- 2022-10-28 keepalived對nginx進行高可用搭建及原理詳解_nginx
- 2022-06-20 一文帶你掌握Go語言運算符的使用_Golang
- 2023-01-12 Golang單元測試與斷言編寫流程詳解_Golang
- 2022-04-24 python使用技巧-文件讀寫_python
- 2022-10-27 使用python+pandas讀寫xlsx格式中的數據_python
- 2023-02-12 PyCharm軟件無法安裝lxml庫的問題及解決_python
- 欄目分類
-
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支