From 32b747014dcb8804a9cbe13a12a3866bf454517f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Wed, 13 Feb 2019 15:09:14 +0800 Subject: [PATCH] feature[Navbar]: add header-search component(#1591) --- package.json | 1 + src/components/HeaderSearch/index.vue | 187 +++++++++++++++++++++++++ src/icons/svg/search.svg | 1 + src/views/layout/components/Navbar.vue | 38 +++-- 4 files changed, 215 insertions(+), 12 deletions(-) create mode 100644 src/components/HeaderSearch/index.vue create mode 100644 src/icons/svg/search.svg diff --git a/package.json b/package.json index 84bc63c4589..3669a297fc7 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "echarts": "4.1.0", "element-ui": "2.4.10", "file-saver": "1.3.8", + "fuse.js": "3.4.2", "js-cookie": "2.2.0", "jsonlint": "1.6.3", "jszip": "3.1.5", diff --git a/src/components/HeaderSearch/index.vue b/src/components/HeaderSearch/index.vue new file mode 100644 index 00000000000..ab0d556a71b --- /dev/null +++ b/src/components/HeaderSearch/index.vue @@ -0,0 +1,187 @@ + + + + + diff --git a/src/icons/svg/search.svg b/src/icons/svg/search.svg new file mode 100644 index 00000000000..84233ddaa98 --- /dev/null +++ b/src/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index 4f94b055337..650126289d2 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -6,24 +6,26 @@
- +
@@ -57,6 +59,7 @@ import Screenfull from '@/components/Screenfull' import SizeSelect from '@/components/SizeSelect' import LangSelect from '@/components/LangSelect' import ThemePicker from '@/components/ThemePicker' +import Search from '@/components/HeaderSearch' export default { components: { @@ -66,7 +69,8 @@ export default { Screenfull, SizeSelect, LangSelect, - ThemePicker + ThemePicker, + Search }, computed: { ...mapGetters([ @@ -100,6 +104,7 @@ export default { float: left; cursor: pointer; transition: background .3s; + &:hover { background: rgba(0, 0, 0, .025) } @@ -124,26 +129,35 @@ export default { } .right-menu-item { - cursor: pointer; display: inline-block; padding: 0 8px; height: 100%; - font-size: 20px; + font-size: 18px; color: #5a5e66; vertical-align: text-bottom; - transition: background .3s; - &:hover { - background: rgba(0, 0, 0, .025) + + &.hover-effect { + cursor: pointer; + transition: background .3s; + + &:hover { + background: rgba(0, 0, 0, .025) + } } } .avatar-container { margin-right: 30px; + .avatar-wrapper { margin-top: 5px; position: relative; +<<<<<<< HEAD line-height: initial; cursor: pointer; +======= + +>>>>>>> c71f311... feature[Navbar]: add header-search component (#1591) .user-avatar { width: 40px; height: 40px;