mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Toast: fix instance when SSR (#1927)
This commit is contained in:
parent
3d8a2c795f
commit
8fa5bafcbe
@ -20,6 +20,11 @@ let singleton = true;
|
|||||||
let currentOptions = { ...defaultOptions };
|
let currentOptions = { ...defaultOptions };
|
||||||
|
|
||||||
function createInstance() {
|
function createInstance() {
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if (isServer) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
if (!queue.length || !singleton) {
|
if (!queue.length || !singleton) {
|
||||||
const toast = new (Vue.extend(VueToast))({
|
const toast = new (Vue.extend(VueToast))({
|
||||||
el: document.createElement('div')
|
el: document.createElement('div')
|
||||||
@ -37,11 +42,6 @@ function transformer(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Toast(options = {}) {
|
function Toast(options = {}) {
|
||||||
/* istanbul ignore if */
|
|
||||||
if (isServer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const toast = createInstance();
|
const toast = createInstance();
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user