mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 09:24:25 +00:00
[bugfix] Toast: fix instance when SSR (#1927)
This commit is contained in:
@@ -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 = {
|
||||
|
Reference in New Issue
Block a user