Browse Source

setfoucs

master
pengjun 2 years ago
parent
commit
64e19a2f3a
  1. 23
      src/views/basic-dictionary/BirthPlace.vue

23
src/views/basic-dictionary/BirthPlace.vue

@ -94,7 +94,7 @@
></el-col> ></el-col>
<el-col :span="7"> <el-col :span="7">
<el-form-item label="名称" prop="displayName"> <el-form-item label="名称" prop="displayName">
<el-input
<el-input
ref="refinput" ref="refinput"
v-model="form.displayName" v-model="form.displayName"
style="width: 100%" style="width: 100%"
@ -366,6 +366,7 @@ export default {
}, },
// //
edit(row) { edit(row) {
this.resetFields()
this.form = { ...this.curRow }; this.form = { ...this.curRow };
if (this.form.id == undefined) { if (this.form.id == undefined) {
this.$message.warning("请选择操作的数据"); this.$message.warning("请选择操作的数据");
@ -373,8 +374,11 @@ export default {
this.title = 2; this.title = 2;
// this.form = row; // this.form = row;
this.dialogVisible = true; this.dialogVisible = true;
this.getFocus();
} }
}, },
// //
addoredit() { addoredit() {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
@ -420,15 +424,26 @@ export default {
// //
add() { add() {
this.form = { ...this.curRow };
this.dialogVisible = true; this.dialogVisible = true;
this.title = 1; this.title = 1;
this.form = {}; this.form = {};
this.resetFields();
this.getFocus();
},
getFocus(){
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.refinput.focus(); this.$refs.refinput.focus();
});
});
},
resetFields(){
this.$nextTick(() => {
this.$refs.form.resetFields();
});
}, },
//
getlist() { getlist() {
nativeplacelist(this.pages).then((res) => { nativeplacelist(this.pages).then((res) => {
this.initTableData = [...res.data.items]; this.initTableData = [...res.data.items];

Loading…
Cancel
Save