From 5b426abdbd2cb9fee62dd88842a865b61498f263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E7=9A=93?= Date: Wed, 3 Feb 2021 23:42:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui/dialog=20picker):=20=E4=BC=98=E5=8C=96cl?= =?UTF-8?q?ose=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit affects: @varlet/ui --- packages/varlet-ui/src/dialog/example/index.vue | 8 +------- packages/varlet-ui/src/dialog/index.ts | 7 +++++-- packages/varlet-ui/src/picker/index.ts | 7 +++++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/varlet-ui/src/dialog/example/index.vue b/packages/varlet-ui/src/dialog/example/index.vue index c66d8ecdaf5..a125e90df1f 100644 --- a/packages/varlet-ui/src/dialog/example/index.vue +++ b/packages/varlet-ui/src/dialog/example/index.vue @@ -47,16 +47,10 @@ export default defineComponent({ message: '测试文字测试文字测试文字测试文字测试文字测试文字测试文字', }) await Dialog({ - title: '测试1', + title: '测试2', cancelButton: false, message: '测试文字测试文字测试文字测试文字测试文字测试文字测试文字', }) - // Dialog.close() - // Dialog({ - // title: '测试2', - // cancelButton: false, - // message: '测试文字测试文字测试文字测试文字测试文字测试文字测试文字', - // }) // setTimeout(() => { // Dialog.close() diff --git a/packages/varlet-ui/src/dialog/index.ts b/packages/varlet-ui/src/dialog/index.ts index b2b78f3c9d8..75ab2950b3e 100644 --- a/packages/varlet-ui/src/dialog/index.ts +++ b/packages/varlet-ui/src/dialog/index.ts @@ -1,4 +1,4 @@ -import { reactive, App } from 'vue' +import { reactive, App, nextTick } from 'vue' import VarDialog from './Dialog.vue' import { isString } from '../utils/shared' import { mountInstance } from '../utils/components' @@ -79,7 +79,10 @@ Dialog.install = function (app: App) { Dialog.close = () => { if (singletonOptions) { - singletonOptions.show = false + const options = singletonOptions + nextTick().then(() => { + options.show = false + }) singletonOptions = null } } diff --git a/packages/varlet-ui/src/picker/index.ts b/packages/varlet-ui/src/picker/index.ts index db7852a920c..599aeeb4499 100644 --- a/packages/varlet-ui/src/picker/index.ts +++ b/packages/varlet-ui/src/picker/index.ts @@ -1,4 +1,4 @@ -import { App, reactive } from 'vue' +import { App, nextTick, reactive } from 'vue' import VarPicker from './Picker.vue' import { NormalColumn, CascadeColumn } from './props' import { isArray } from '../utils/shared' @@ -97,7 +97,10 @@ Picker.install = function (app: App) { Picker.close = () => { if (singletonOptions) { - singletonOptions.show = false + const options = singletonOptions + nextTick().then(() => { + options.show = false + }) singletonOptions = null } }