Skip to content

Commit

Permalink
[bugfix] Toast: fix instance when SSR (#1927)
Browse files Browse the repository at this point in the history
  • Loading branch information
gongzhibin authored and chenjiahan committed Oct 12, 2018
1 parent 3d8a2c7 commit 8fa5baf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/toast/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -37,11 +42,6 @@ function transformer(options) {
}

function Toast(options = {}) {
/* istanbul ignore if */
if (isServer) {
return;
}

const toast = createInstance();

options = {
Expand Down

0 comments on commit 8fa5baf

Please sign in to comment.