diff --git a/docs/layout.md b/docs/layout.md index 516d459..6772fca 100644 --- a/docs/layout.md +++ b/docs/layout.md @@ -11,7 +11,7 @@ Take a new layout named `secondary` as an example to make the route starting wit            {                name: 'primary',                include: [/.*/], -               exlude: [/(\/(en|zh))*\/login/, /(\/(en|zh))*\/seconday\/(.*)/], +               exclude: [/(\/(en|zh))*\/login/, /(\/(en|zh))*\/seconday\/(.*)/],            },            {                name: 'secondary', diff --git a/docs/zh-cn/configuration.md b/docs/zh-cn/configuration.md index 5189c02..70f517f 100644 --- a/docs/zh-cn/configuration.md +++ b/docs/zh-cn/configuration.md @@ -44,7 +44,7 @@ { name: 'primary', include: [/.*/], - exlude: [/(\/(en|zh))*\/login/], + exclude: [/(\/(en|zh))*\/login/], }, ], ``` @@ -55,9 +55,9 @@ - `include` - 指定使用该布局的路由规则列表,规则可为正则表达式或者字符串; - - `exlude` - 指定不使用该布局的路由规则列表,规则可为正则表达式或者字符串。 + - `exclude` - 指定不使用该布局的路由规则列表,规则可为正则表达式或者字符串。 - > 注意:`exlude` 优先级高于 `include`,前面的布局优先级高于后面的布局。开发过程中可能需要结合`src/layouts`目录下的布局使用,具体方法可查看 [使用布局](./layout.md)。 + > 注意:`exclude` 优先级高于 `include`,前面的布局优先级高于后面的布局。开发过程中可能需要结合`src/layouts`目录下的布局使用,具体方法可查看 [使用布局](./layout.md)。 ## i18n diff --git a/docs/zh-cn/layout.md b/docs/zh-cn/layout.md index 75b747c..285bd40 100644 --- a/docs/zh-cn/layout.md +++ b/docs/zh-cn/layout.md @@ -11,7 +11,7 @@ { name: 'primary', include: [/.*/], - exlude: [/(\/(en|zh))*\/login/, /(\/(en|zh))*\/seconday\/(.*)/], + exclude: [/(\/(en|zh))*\/login/, /(\/(en|zh))*\/seconday\/(.*)/], }, { name: 'secondary', diff --git a/src/utils/config.js b/src/utils/config.js index fcc50d0..3897746 100644 --- a/src/utils/config.js +++ b/src/utils/config.js @@ -10,7 +10,7 @@ module.exports = { { name: 'primary', include: [/.*/], - exlude: [/(\/(en|zh))*\/login/], + exclude: [/(\/(en|zh))*\/login/], }, ], diff --git a/src/utils/index.js b/src/utils/index.js index 33bd195..1ea50c8 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -211,7 +211,7 @@ export function queryLayout(layouts, pathname) { for (const item of layouts) { let include = false - let exlude = false + let exclude = false if (item.include) { for (const regepx of item.include) { if (isMatch(regepx)) { @@ -221,16 +221,16 @@ export function queryLayout(layouts, pathname) { } } - if (include && item.exlude) { - for (const regepx of item.exlude) { + if (include && item.exclude) { + for (const regepx of item.exclude) { if (isMatch(regepx)) { - exlude = true + exclude = true break } } } - if (include && !exlude) { + if (include && !exclude) { result = item.name break }