[bugfix] Toast: fix instance when SSR (#1927)

This commit is contained in:
zxlg 2018-10-12 20:05:07 +08:00 committed by neverland
parent 3d8a2c795f
commit 8fa5bafcbe

View File

@ -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 = {