mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
refactor(nuxt): use unref
in layout.ts
(#7818)
Co-authored-by: chenying <1770365139@qq.com>
This commit is contained in:
parent
71ef8bd3ff
commit
30277da960
@ -1,4 +1,4 @@
|
|||||||
import { defineComponent, isRef, nextTick, onMounted, Ref, Transition, VNode } from 'vue'
|
import { defineComponent, unref, nextTick, onMounted, Ref, Transition, VNode } from 'vue'
|
||||||
import { _wrapIf } from './utils'
|
import { _wrapIf } from './utils'
|
||||||
import { useRoute } from '#app'
|
import { useRoute } from '#app'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -29,7 +29,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
const layout = (isRef(props.name) ? props.name.value : props.name) ?? route.meta.layout as string ?? 'default'
|
const layout = unref(props.name) ?? route.meta.layout as string ?? 'default'
|
||||||
|
|
||||||
const hasLayout = layout && layout in layouts
|
const hasLayout = layout && layout in layouts
|
||||||
if (process.dev && layout && !hasLayout && layout !== 'default') {
|
if (process.dev && layout && !hasLayout && layout !== 'default') {
|
||||||
|
Loading…
Reference in New Issue
Block a user