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

[Feature Request] Allow defaultLayout accept a function #150

Open
ModyQyW opened this issue Mar 15, 2024 · 0 comments
Open

[Feature Request] Allow defaultLayout accept a function #150

ModyQyW opened this issue Mar 15, 2024 · 0 comments

Comments

@ModyQyW
Copy link

ModyQyW commented Mar 15, 2024

Background

Sometimes we may need to setup different layouts. Indeed this plugin provides a way to set route layout (with meta.layout in route block). However, we have to update files one by one in this way. It costs lots of time and energy to do so.

Expection

I am hoping that we make defaultLayout accept a function or a string, which the function can return a string by passed route. It looks like below:

import Vue from '@vitejs/plugin-vue';
import Pages from 'vite-plugin-pages';
import Layouts from 'vite-plugin-vue-layouts';

export default {
  plugins: [
    Vue(),
    Pages(),
    Layouts({
      defaultLayout: (route) => { ... }, // return a string, like 'default' or 'myLayout'
    }),
  ],
};

I would like to listen to your thoughts.

Additon

I will be glad to submit a PR if you think this is valuable.I have no idea how to do this. Sorry.

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