travel/admin/node_modules/.cache/vue-loader/205154352c6d52f1b05130312ff...

1 line
10 KiB
JSON

{"remainingRequest":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\phpstudy_pro\\WWW\\travel\\admin\\src\\components\\HeaderSearch\\index.vue?vue&type=script&lang=js","dependencies":[{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\src\\components\\HeaderSearch\\index.vue","mtime":1718070785999},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1718764957200},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\babel-loader\\lib\\index.js","mtime":1718764959024},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1718764957200},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\vue-loader\\lib\\index.js","mtime":1718764959862}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:Ly8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KLy8KDQovLyBmdXNlIGlzIGEgbGlnaHR3ZWlnaHQgZnV6enktc2VhcmNoIG1vZHVsZQ0KLy8gbWFrZSBzZWFyY2ggcmVzdWx0cyBtb3JlIGluIGxpbmUgd2l0aCBleHBlY3RhdGlvbnMNCmltcG9ydCBGdXNlIGZyb20gJ2Z1c2UuanMnDQppbXBvcnQgcGF0aCBmcm9tICdwYXRoJw0KDQpleHBvcnQgZGVmYXVsdCB7DQogIG5hbWU6ICdIZWFkZXJTZWFyY2gnLA0KICBkYXRhKCkgew0KICAgIHJldHVybiB7DQogICAgICBzZWFyY2g6ICcnLA0KICAgICAgb3B0aW9uczogW10sDQogICAgICBzZWFyY2hQb29sOiBbXSwNCiAgICAgIHNob3c6IGZhbHNlLA0KICAgICAgZnVzZTogdW5kZWZpbmVkDQogICA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ICBxdWVyeVNlYXJjaChxdWVyeSkgew0KICAgICAgaWYgKHF1ZXJ5ICE9PSAnJykgew0KICAgICAgICB0aGlzLm9wdGlvbnMgPSB0aGlzLmZ1c2Uuc2VhcmNoKHF1ZXJ5KQ0KICAgICAgfSBlbHNlIHsNCiAgICAgICAgdGhpcy5vcHRpb25zID0gW10NCiAgICAgIH0NCiAgICB9DQogIH0NCn0NCg=="},{"version":3,"sources":["index.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.vue","sourceRoot":"src/components/HeaderSearch","sourcesContent":["<template>\r\n <div :class=\"{'show':show}\" class=\"header-search\">\r\n <svg-icon class-name=\"search-icon\" icon-class=\"search\" @click.stop=\"click\" />\r\n <el-select\r\n ref=\"headerSearchSelect\"\r\n v-model=\"search\"\r\n :remote-method=\"querySearch\"\r\n filterable\r\n default-first-option\r\n remote\r\n placeholder=\"Search\"\r\n class=\"header-search-select\"\r\n @change=\"change\"\r\n >\r\n <el-option v-for=\"item in options\" :key=\"item.path\" :value=\"item\" :label=\"item.title.join(' > ')\" />\r\n </el-select>\r\n </div>\r\n</template>\r\n\r\n<script>\r\n// fuse is a lightweight fuzzy-search module\r\n// make search results more in line with expectations\r\nimport Fuse from 'fuse.js'\r\nimport path from 'path'\r\n\r\nexport default {\r\n name: 'HeaderSearch',\r\n data() {\r\n return {\r\n search: '',\r\n options: [],\r\n searchPool: [],\r\n show: false,\r\n fuse: undefined\r\n }\r\n },\r\n computed: {\r\n routes() {\r\n return this.$store.getters.permission_routes\r\n }\r\n },\r\n watch: {\r\n routes() {\r\n this.searchPool = this.generateRoutes(this.routes)\r\n },\r\n searchPool(list) {\r\n this.initFuse(list)\r\n },\r\n show(value) {\r\n if (value) {\r\n document.body.addEventListener('click', this.close)\r\n } else {\r\n document.body.removeEventListener('click', this.close)\r\n }\r\n }\r\n },\r\n mounted() {\r\n this.searchPool = this.generateRoutes(this.routes)\r\n },\r\n methods: {\r\n click() {\r\n this.show = !this.show\r\n if (this.show) {\r\n this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()\r\n }\r\n },\r\n close() {\r\n this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur()\r\n this.options = []\r\n this.show = false\r\n },\r\n change(val) {\r\n this.$router.push(val.path)\r\n this.search = ''\r\n this.options = []\r\n this.$nextTick(() => {\r\n this.show = false\r\n })\r\n },\r\n initFuse(list) {\r\n this.fuse = new Fuse(list, {\r\n shouldSort: true,\r\n threshold: 0.4,\r\n location: 0,\r\n distance: 100,\r\n maxPatternLength: 32,\r\n minMatchCharLength: 1,\r\n keys: [{\r\n name: 'title',\r\n weight: 0.7\r\n }, {\r\n name: 'path',\r\n weight: 0.3\r\n }]\r\n })\r\n },\r\n // Filter out the routes that can be displayed in the sidebar\r\n // And generate the internationalized title\r\n generateRoutes(routes, basePath = '/', prefixTitle = []) {\r\n let res = []\r\n\r\n for (const router of routes) {\r\n // skip hidden router\r\n if (router.hidden) { continue }\r\n\r\n const data = {\r\n path: path.resolve(basePath, router.path),\r\n title: [...prefixTitle]\r\n }\r\n\r\n if (router.meta && router.meta.title) {\r\n data.title = [...data.title, router.meta.title]\r\n\r\n if (router.redirect !== 'noRedirect') {\r\n // only push the routes with title\r\n // special case: need to exclude parent router without redirect\r\n res.push(data)\r\n }\r\n }\r\n\r\n // recursive child routes\r\n if (router.children) {\r\n const tempRoutes = this.generateRoutes(router.children, data.path, data.title)\r\n if (tempRoutes.length >= 1) {\r\n res = [...res, ...tempRoutes]\r\n }\r\n }\r\n }\r\n return res\r\n },\r\n querySearch(query) {\r\n if (query !== '') {\r\n this.options = this.fuse.search(query)\r\n } else {\r\n this.options = []\r\n }\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.header-search {\r\n font-size: 0 !important;\r\n\r\n .search-icon {\r\n cursor: pointer;\r\n font-size: 18px;\r\n vertical-align: middle;\r\n }\r\n\r\n .header-search-select {\r\n font-size: 18px;\r\n transition: width 0.2s;\r\n width: 0;\r\n overflow: hidden;\r\n background: transparent;\r\n border-radius: 0;\r\n display: inline-block;\r\n vertical-align: middle;\r\n\r\n ::v-deep .el-input__inner {\r\n border-radius: 0;\r\n border: 0;\r\n padding-left: 0;\r\n padding-right: 0;\r\n box-shadow: none !important;\r\n border-bottom: 1px solid #d9d9d9;\r\n vertical-align: middle;\r\n }\r\n }\r\n\r\n &.show {\r\n .header-search-select {\r\n width: 210px;\r\n margin-left: 10px;\r\n }\r\n }\r\n}\r\n</style>\r\n"]}]}