Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[新功能需求] 自动根据Page 文件夹创建路由系统,写入Page.json 文件 #20

Open
BF-zh opened this issue Oct 29, 2024 · 0 comments

Comments

@BF-zh
Copy link

BF-zh commented Oct 29, 2024

这个功能解决了什么问题?

每次添加页面之后,还需要手动去修改 page.json 文件

createRouter 也可以模仿 vue的路由

createReoutr({
  path: '/user',
  name: 'user',
  mate: {
    title: '用户中心',
    icon: 'user',
  },
  component: () => import('@/views/user/index.vue'),
  children: [
    {
      path: 'login',
      component: () => import('@/views/user/login.vue'),
    },
    {
      path: 'register',
      component: () => import('@/views/user/register.vue'),
    },
  ],
})

这里这个 children 可以看一下 UniLayouts 怎么实现的

你期望的 API 是什么样子的?

/// vite.config.ts

import uniRouter from 'uni-mini-router'

defineConfig({
  plugin: [
    uniRouter({
      pagePath: './pages',// default './pages' pages 文件夹路径
      autoGenrate: true,// default false 自动扫描pages 文件 生成 page.json
    }),
  ],
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant