From 8fa5bafcbe98003271fd3abbcbb0902b755b9759 Mon Sep 17 00:00:00 2001 From: zxlg <2271721552@qq.com> Date: Fri, 12 Oct 2018 20:05:07 +0800 Subject: [PATCH] [bugfix] Toast: fix instance when SSR (#1927) --- packages/toast/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/toast/index.js b/packages/toast/index.js index b004aa92b..9d19539ca 100644 --- a/packages/toast/index.js +++ b/packages/toast/index.js @@ -20,6 +20,11 @@ let singleton = true; let currentOptions = { ...defaultOptions }; function createInstance() { + /* istanbul ignore if */ + if (isServer) { + return {}; + } + if (!queue.length || !singleton) { const toast = new (Vue.extend(VueToast))({ el: document.createElement('div') @@ -37,11 +42,6 @@ function transformer(options) { } function Toast(options = {}) { - /* istanbul ignore if */ - if (isServer) { - return; - } - const toast = createInstance(); options = {