mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
fix(nuxt): add missing imports to <NuxtClientFallback>
(#20237)
This commit is contained in:
parent
22f1f71e3e
commit
e5d1d29b1d
@ -1,4 +1,5 @@
|
|||||||
import { createElementBlock, defineComponent } from 'vue'
|
import { createElementBlock, defineComponent, onMounted, ref } from 'vue'
|
||||||
|
import { useState } from '../composables/state'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'NuxtClientFallback',
|
name: 'NuxtClientFallback',
|
@ -1,5 +1,6 @@
|
|||||||
import { defineComponent, getCurrentInstance, onErrorCaptured } from 'vue'
|
import { defineComponent, getCurrentInstance, onErrorCaptured, ref } from 'vue'
|
||||||
import { ssrRenderAttrs, ssrRenderSlot, ssrRenderVNode } from 'vue/server-renderer'
|
import { ssrRenderAttrs, ssrRenderSlot, ssrRenderVNode } from 'vue/server-renderer'
|
||||||
|
import { useState } from '../composables/state'
|
||||||
import { createBuffer } from './utils'
|
import { createBuffer } from './utils'
|
||||||
|
|
||||||
const NuxtClientFallbackServer = defineComponent({
|
const NuxtClientFallbackServer = defineComponent({
|
||||||
@ -40,8 +41,8 @@ const NuxtClientFallbackServer = defineComponent({
|
|||||||
const defaultSlot = ctx.slots.default?.()
|
const defaultSlot = ctx.slots.default?.()
|
||||||
const ssrVNodes = createBuffer()
|
const ssrVNodes = createBuffer()
|
||||||
|
|
||||||
for (let i = 0; i < defaultSlot.length; i++) {
|
for (let i = 0; i < (defaultSlot?.length || 0); i++) {
|
||||||
ssrRenderVNode(ssrVNodes.push, defaultSlot[i], vm)
|
ssrRenderVNode(ssrVNodes.push, defaultSlot![i], vm!)
|
||||||
}
|
}
|
||||||
|
|
||||||
return { ssrFailed, ssrVNodes }
|
return { ssrFailed, ssrVNodes }
|
||||||
@ -52,7 +53,7 @@ const NuxtClientFallbackServer = defineComponent({
|
|||||||
return { ssrFailed: true, ssrVNodes: [] }
|
return { ssrFailed: true, ssrVNodes: [] }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ssrRender (ctx, push, parent) {
|
ssrRender (ctx: any, push: any, parent: any) {
|
||||||
if (ctx.ssrFailed) {
|
if (ctx.ssrFailed) {
|
||||||
const { fallback, placeholder } = ctx.$slots
|
const { fallback, placeholder } = ctx.$slots
|
||||||
if (fallback || placeholder) {
|
if (fallback || placeholder) {
|
Loading…
Reference in New Issue
Block a user