Skip to content

Commit 60977b8

Browse files
committed
update
1 parent 2a100fe commit 60977b8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/plugins/search/search.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,18 @@ export function search(query) {
199199
export function init(config, vm) {
200200
const isAuto = config.paths === 'auto';
201201
const paths = isAuto ? getAllPaths(vm.router) : config.paths;
202-
203202
let namespaceSuffix = '';
204203

205204
// only in auto mode
206-
if (isAuto && config.pathNamespaces) {
205+
if (paths.length && isAuto && config.pathNamespaces) {
207206
const path = paths[0];
208207

209208
if (Array.isArray(config.pathNamespaces)) {
210209
namespaceSuffix =
211-
config.pathNamespaces.find(prefix => path && path.startsWith(prefix)) ||
210+
config.pathNamespaces.find(prefix => path.startsWith(prefix)) ||
212211
namespaceSuffix;
213212
} else if (config.pathNamespaces instanceof RegExp) {
214-
const matches = path && path.match(config.pathNamespaces);
213+
const matches = path.match(config.pathNamespaces);
215214

216215
if (matches) {
217216
namespaceSuffix = matches[0];

0 commit comments

Comments
 (0)