From a585fecf3b57e6201d31943f136e15fc104b041f Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Wed, 27 May 2020 11:15:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4focus=20=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/directive/focus/focus.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/directive/focus/focus.js b/src/directive/focus/focus.js index 7c3b68b65..512c0d1df 100644 --- a/src/directive/focus/focus.js +++ b/src/directive/focus/focus.js @@ -1,18 +1,21 @@ export default { - // 当被绑定的元素插入到 DOM 中时 - inserted: function (el, obj) { - // 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定 - // 对值进行判断 - if (obj.value) { - // 聚焦元素 - el.focus(); - } - }, - // 当指令所在组件的 VNode 及其子 VNode 全部更新后调用 - // 这是每当绑定的值发生改变时触发的钩子函数 - componentUpdated: function (el, obj) { - if (obj.value) { - el.focus(); - } - } + // 当被绑定的元素插入到 DOM 中时 + inserted: function (el, obj) { + // 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定 + // 对值进行判断 + const dom = el.querySelector('input') || el.querySelector('textarea'); + dom.focus(); + // el.focus(); + // if (obj.value) { + // // 聚焦元素 + // el.focus(); + // } + }, + // 当指令所在组件的 VNode 及其子 VNode 全部更新后调用 + // 这是每当绑定的值发生改变时触发的钩子函数 + componentUpdated: function (el, obj) { + if (obj.value) { + el.focus(); + } + } }; From 61b0d22d5370ffd2bec4cba84b56192d0f52e660 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Wed, 27 May 2020 11:20:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E7=B3=BB=E7=BB=9F=20?= =?UTF-8?q?=E5=AE=9E=E6=93=8D=E5=88=97=E8=A1=A8=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitionManage/practiceList/create.vue | 23 ++++++++++++++++--- .../competitionManage/practiceList/index.vue | 7 +++--- src/views/scriptManage/create.vue | 2 -- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/views/competitionManage/practiceList/create.vue b/src/views/competitionManage/practiceList/create.vue index 498c4d1a6..e612b68b7 100644 --- a/src/views/competitionManage/practiceList/create.vue +++ b/src/views/competitionManage/practiceList/create.vue @@ -19,13 +19,18 @@ export default { default() { return ''; } + }, + raceList:{ + type: Array, + default() { + return ''; + } } }, data() { return { dialogVisible: false, - mapList: [], - taskStatusList: [], + isEdit:false, formModel: { name: '', mapId: '', @@ -34,11 +39,19 @@ export default { }; }, computed: { + raceInfoList() { + const racelist = []; + this.raceList.forEach(each=>{ + racelist.push({label:each.name, value:each.id}); + }); + return racelist; + }, form() { const form = { labelWidth: '120px', items: [ { prop: 'name', label: '实操名称', type: 'text' }, + { prop:'raceId', label:'竞赛名称', type:'select', options:this.raceInfoList, disabled:this.isEdit}, { prop: 'description', label: '实操描述', type: 'textarea' } ] }; @@ -53,6 +66,9 @@ export default { description: [ { validator: this.validateDescription, trigger: 'blur' }, { validator: this.validateDescription, trigger: 'change' } + ], + raceId:[ + { required: true, message: '请选择竞赛', trigger: 'change' } ] }; return crules; @@ -82,12 +98,13 @@ export default { this.formModel = data; this.formModel.id = questid; this.dialogVisible = true; + this.isEdit = true; }); } else { this.formModel.mapId = this.$route.params.mapId; this.dialogVisible = true; + this.isEdit = false; } - }, doCreate() { const self = this; diff --git a/src/views/competitionManage/practiceList/index.vue b/src/views/competitionManage/practiceList/index.vue index 95512d719..401a0b737 100644 --- a/src/views/competitionManage/practiceList/index.vue +++ b/src/views/competitionManage/practiceList/index.vue @@ -1,8 +1,8 @@