| 331 | }; |
| 332 | |
| 333 | var install = function (hook, vm) { |
| 334 | var util = Docsify.util; |
| 335 | var opts = vm.config.search || CONFIG; |
| 336 | |
| 337 | if (Array.isArray(opts)) { |
| 338 | CONFIG.paths = opts; |
| 339 | } else if (typeof opts === 'object') { |
| 340 | CONFIG.paths = Array.isArray(opts.paths) ? opts.paths : 'auto'; |
| 341 | CONFIG.maxAge = util.isPrimitive(opts.maxAge) ? opts.maxAge : CONFIG.maxAge; |
| 342 | CONFIG.placeholder = opts.placeholder || CONFIG.placeholder; |
| 343 | CONFIG.noData = opts.noData || CONFIG.noData; |
| 344 | CONFIG.depth = opts.depth || CONFIG.depth; |
| 345 | CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent; |
| 346 | CONFIG.namespace = opts.namespace || CONFIG.namespace; |
| 347 | } |
| 348 | |
| 349 | var isAuto = CONFIG.paths === 'auto'; |
| 350 | |
| 351 | hook.mounted(function (_) { |
| 352 | init$1(CONFIG, vm); |
| 353 | !isAuto && init(CONFIG, vm); |
| 354 | }); |
| 355 | hook.doneEach(function (_) { |
| 356 | update(CONFIG, vm); |
| 357 | isAuto && init(CONFIG, vm); |
| 358 | }); |
| 359 | }; |
| 360 | |
| 361 | $docsify.plugins = [].concat(install, $docsify.plugins); |
| 362 | |