From 03b3ea5ba03e5c2de56292fde54bc6c0aad299d7 Mon Sep 17 00:00:00 2001 From: lishengzxc Date: Thu, 23 Jun 2016 23:03:36 +0800 Subject: [PATCH] replace setTimeout with Vue.nextTick & add vue dependency --- package.json | 3 ++- src/msgbox.vue | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2867cb0..8212e7c 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "webpack-dev-server": "^1.14.0" }, "dependencies": { + "vue": "^1.0.25", "vue-popup": "^0.1.8" } -} +} \ No newline at end of file diff --git a/src/msgbox.vue b/src/msgbox.vue index 1d610b5..574fd85 100644 --- a/src/msgbox.vue +++ b/src/msgbox.vue @@ -263,11 +263,11 @@ visible(val) { if (val && this.$type === 'prompt') { - setTimeout(() => { + Vue.nextTick(() => { if (this.$els.input) { this.$els.input.focus(); } - }, 500); + }); } } },