From 9f14383eae2821c5eb5cb8eb78ebec1037fe07ba Mon Sep 17 00:00:00 2001 From: Frost-ZX <30585462+Frost-ZX@users.noreply.github.com> Date: Sun, 6 Mar 2022 23:55:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/css/main.less | 31 +++++ src/components/BtnSearch.vue | 28 ++++ src/components/BtnToTop.vue | 34 +---- src/components/SearchPanel.vue | 233 +++++++++++++++++++++++++++++++++ src/views/ContentView.vue | 25 ++++ 5 files changed, 320 insertions(+), 31 deletions(-) create mode 100644 src/components/BtnSearch.vue create mode 100644 src/components/SearchPanel.vue diff --git a/src/assets/css/main.less b/src/assets/css/main.less index 0262b11..2fa3738 100644 --- a/src/assets/css/main.less +++ b/src/assets/css/main.less @@ -30,6 +30,37 @@ html, body, #app { -webkit-tap-highlight-color: transparent; } +.float-btn { + display: flex; + align-items: center; + justify-content: center; + width: 2.25rem; + height: 2.25rem; + box-shadow: + 0 0.15rem 0.15rem 0 rgba(0, 0, 0, 0.14), + 0 0.2rem 0.1rem -0.15rem rgba(0, 0, 0, 0.12), + 0 0.1rem 0.3rem 0 rgba(0, 0, 0, 0.2); + border-radius: 0.25rem; + background-color: var(--color-green); + color: #FFF; + font-size: 1rem; + line-height: 1; + cursor: pointer; + + &:hover .cover { + opacity: 0.2; + } + + .cover { + position: absolute; + width: 100%; + height: 100%; + background-color: #FFF; + opacity: 0; + transition: opacity 0.25s; + } +} + /* Buefy */ // 导航栏 diff --git a/src/components/BtnSearch.vue b/src/components/BtnSearch.vue new file mode 100644 index 0000000..7c9fb89 --- /dev/null +++ b/src/components/BtnSearch.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/components/BtnToTop.vue b/src/components/BtnToTop.vue index 5c5cd8d..29524ce 100644 --- a/src/components/BtnToTop.vue +++ b/src/components/BtnToTop.vue @@ -1,5 +1,5 @@ + + + + + + @@ -94,16 +107,20 @@ import { setTitle, toast } from '@/assets/js/utils'; import { getContentFile } from '@/request/index'; +import BtnSearch from '@/components/BtnSearch'; import BtnToTop from '@/components/BtnToTop'; import ContentIndex from '@/components/ContentIndex'; import MarkdownParser from '@/components/MarkdownParser'; +import SearchPanel from '@/components/SearchPanel'; export default { name: 'ContentView', components: { + BtnSearch, BtnToTop, ContentIndex, MarkdownParser, + SearchPanel, }, data() { return { @@ -114,6 +131,9 @@ export default { /** 是否正在载入内容 */ isLoading: false, + /** 是否显示搜索面板 */ + isShowSearch: false, + /** 是否在移动端显示侧边栏 */ isShowSidebar: false, @@ -319,6 +339,11 @@ export default { this.isLoading = isLoading; }, + /** 切换显示隐藏搜索面板 */ + toggleSearch(isShow = false) { + this.isShowSearch = isShow; + }, + /** 切换侧边栏显示隐藏 */ toggleSidebar() { this.isShowSidebar = !this.isShowSidebar;