Skip to content

【layout: false】在分包页面中失效 #83

@matrix-zyh

Description

@matrix-zyh

描述问题

我在 layouts 中编写了两个布局系统,sys 和 tabbar,插件默认布局使用的 sys,区别是 sys 布局只有自定义 navbar 标题栏。tabbar 布局拥有 navbar 和 tabbar 两个组件。
我有三个 tabbar 页面,定义在主包中,tabbar 页面中使用 layout: false 是生效的,但是在 sub-xxx 分包中使用 layout: false 并没有生效,分包页面依然继承了 sys 的默认布局。

复现

tabbar 页面 layout: false 页面使用 uni-layout 加载布局系统

<script lang="ts" setup>
definePage(()=> ({
  name: 'pages-workbench',
  layout: false,
  meta: {
    title: '工作台'
  }
}))
</script>
<template>
  <uni-layout name="tabbar">
    <button>获取列表</button>
  </uni-layout>
</template>

// 页面有 navbar 和 tabbar 两个组件  还有 button 按钮。✅正确

tabbar 页面 layout: false

<script lang="ts" setup>
definePage(()=> ({
  name: 'pages-workbench',
  layout: false,
  meta: {
    title: '工作台'
  }
}))
</script>
<template>
    <button>获取列表</button>
</template>

// 页面只有 button 按钮。layout: false 生效。✅正确

分包页面 layout: false

<script lang="ts" setup>
definePage(() => ({
  name: 'sub-app-list',
  layout: false,
  meta: {
    title: '工作台'
  }
}))
</script>
<template>
  <wd-button type="primary" block>
    按钮
  </wd-button>
</template>

// 页面有 navbar,标题名称为“工作台”。layout: false 没有生效。❌错误

系统信息

基础环境信息:

  • os: macOS 26.1
  • node: 24.11.1
  • packageManager: pnpm

基础依赖信息:

  • vue: 3.4.38
  • vite: 5.2.8
  • @dcloudio/uni-app: 3.0.0-4080520251106001

uni-helper依赖信息:

  • @uni-helper/eslint-config: 0.5.0
  • eslint: 9.39.1
  • @uni-helper/plugin-uni: 0.1.0
  • @uni-helper/uni-env: 0.2.0
  • @uni-helper/uni-types: 1.0.0-alpha.6
  • @uni-helper/unocss-preset-uni: 0.2.11
  • unocss: 66.0.0
  • @uni-helper/vite-plugin-uni-components: 0.2.3
  • @uni-helper/vite-plugin-uni-layouts: 0.1.11
  • @uni-helper/vite-plugin-uni-manifest: 0.2.11
  • @uni-helper/vite-plugin-uni-pages: 0.3.22
  • @uni-helper/volar-service-uni-pages: 0.3.22

使用的包管理器

pnpm

核对

贡献

  • 我愿意提交一个 PR 修复这个问题
  • 我愿意提交一个 PR 带有失败的测试(实际上只要去做就好,谢谢!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions