refactor(nuxt): use unref in layout.ts (#7818)

Co-authored-by: chenying <1770365139@qq.com>
This commit is contained in:
chenying 2022-09-26 17:12:20 +08:00 committed by GitHub
parent 71ef8bd3ff
commit 30277da960
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 { useRoute } from '#app'
// @ts-ignore
@ -29,7 +29,7 @@ export default defineComponent({
}
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
if (process.dev && layout && !hasLayout && layout !== 'default') {