Commit e79e540b48be80fb08b67a99e64bede3816b2c9e
1 parent
69af37ec
perf(logo): optimize logo code
Showing
10 changed files
with
56 additions
and
46 deletions
package.json
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | "scripts": { |
5 | 5 | "bootstrap": "yarn install", |
6 | 6 | "serve": "esno ./build/script/preserve.ts && cross-env NODE_ENV=development vite", |
7 | - "build": " rimraf dist && cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts", | |
7 | + "build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts", | |
8 | 8 | "build:site": "cross-env SITE=true npm run build ", |
9 | 9 | "build:no-cache": "yarn clean:cache && npm run build", |
10 | 10 | "typecheck": "typecheck .", | ... | ... |
src/components/Breadcrumb/Breadcrumb.vue
src/components/Menu/src/SearchInput.vue
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | const searchClass = computed(() => { |
49 | 49 | const cls: string[] = []; |
50 | 50 | cls.push(props.theme ? `menu-search-input__search--${props.theme}` : ''); |
51 | - // cls.push(props.collapsed ? 'hide-search-icon' : ''); | |
51 | + cls.push(props.collapsed ? 'hide-search-icon' : ''); | |
52 | 52 | return cls; |
53 | 53 | }); |
54 | 54 | |
... | ... | @@ -66,12 +66,13 @@ |
66 | 66 | .menu-search-input { |
67 | 67 | margin: 12px 8px; |
68 | 68 | |
69 | - // &.hide-search-icon { | |
70 | - // .ant-input, | |
71 | - // .ant-input-suffix { | |
72 | - // opacity: 0; | |
73 | - // } | |
74 | - // } | |
69 | + &.hide-search-icon { | |
70 | + .ant-input, | |
71 | + .ant-input-suffix { | |
72 | + opacity: 0; | |
73 | + transition: all 0.5s; | |
74 | + } | |
75 | + } | |
75 | 76 | |
76 | 77 | &__search--dark { |
77 | 78 | .ant-input-affix-wrapper, | ... | ... |
src/layouts/Logo.vue
1 | 1 | <template> |
2 | - <div class="app-logo" @click="handleGoHome" :style="wrapStyle"> | |
2 | + <div class="app-logo anticon" @click="handleGoHome" :style="wrapStyle"> | |
3 | 3 | <img :src="logo" /> |
4 | 4 | <div v-if="show" class="logo-title ml-2 ellipsis">{{ globSetting.title }}</div> |
5 | 5 | </div> |
... | ... | @@ -79,14 +79,15 @@ |
79 | 79 | align-items: center; |
80 | 80 | padding-left: 16px; |
81 | 81 | cursor: pointer; |
82 | - justify-content: center; | |
82 | + // justify-content: center; | |
83 | 83 | |
84 | 84 | .logo-title { |
85 | - display: none; | |
86 | - font-size: 16px; | |
85 | + font-size: 18px; | |
87 | 86 | font-weight: 400; |
87 | + opacity: 0; | |
88 | + transition: all 0.5s; | |
88 | 89 | .respond-to(medium,{ |
89 | - display: block; | |
90 | + opacity: 1; | |
90 | 91 | }); |
91 | 92 | } |
92 | 93 | } | ... | ... |
src/layouts/default/LayoutMenu.tsx
... | ... | @@ -196,7 +196,14 @@ export default defineComponent({ |
196 | 196 | return () => { |
197 | 197 | const { |
198 | 198 | showLogo, |
199 | - menuSetting: { type: menuType, mode, theme, collapsed, collapsedShowTitle }, | |
199 | + menuSetting: { | |
200 | + type: menuType, | |
201 | + mode, | |
202 | + theme, | |
203 | + collapsed, | |
204 | + collapsedShowTitle, | |
205 | + collapsedShowSearch, | |
206 | + }, | |
200 | 207 | } = unref(getProjectConfigRef); |
201 | 208 | |
202 | 209 | const isSidebarType = menuType === MenuTypeEnum.SIDEBAR; |
... | ... | @@ -212,7 +219,7 @@ export default defineComponent({ |
212 | 219 | collapsedShowTitle={collapsedShowTitle} |
213 | 220 | theme={themeData} |
214 | 221 | showLogo={isShowLogo} |
215 | - search={unref(showSearchRef) && !collapsed} | |
222 | + search={unref(showSearchRef) && (collapsedShowSearch ? true : !collapsed)} | |
216 | 223 | items={unref(menusRef)} |
217 | 224 | flatItems={unref(flatMenusRef)} |
218 | 225 | onClickSearchInput={handleClickSearchInput} |
... | ... | @@ -222,10 +229,7 @@ export default defineComponent({ |
222 | 229 | {{ |
223 | 230 | header: () => |
224 | 231 | isShowLogo && ( |
225 | - <Logo | |
226 | - showTitle={!collapsed} | |
227 | - class={[`layout-menu__logo`, collapsed ? 'justify-center' : '', themeData]} | |
228 | - /> | |
232 | + <Logo showTitle={!collapsed} class={[`layout-menu__logo`, themeData]} /> | |
229 | 233 | ), |
230 | 234 | }} |
231 | 235 | </BasicMenu> | ... | ... |
src/layouts/default/index.less
src/settings/projectSetting.ts
src/types/config.d.ts
src/views/sys/login/Login.vue
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <div class="login-form mx-6"> |
6 | 6 | <div class="login-form__content px-2 py-10"> |
7 | 7 | <header> |
8 | - <img src="/@/assets/images/logo.png" class="mr-4" /> | |
8 | + <img :src="logo" class="mr-4" /> | |
9 | 9 | <h1>{{ title }}</h1> |
10 | 10 | </header> |
11 | 11 | |
... | ... | @@ -74,6 +74,7 @@ |
74 | 74 | // import { appStore } from '/@/store/modules/app'; |
75 | 75 | import { useMessage } from '/@/hooks/web/useMessage'; |
76 | 76 | import { useSetting } from '/@/hooks/core/useSetting'; |
77 | + import logo from '/@/assets/images/logo.png'; | |
77 | 78 | |
78 | 79 | export default defineComponent({ |
79 | 80 | components: { |
... | ... | @@ -149,6 +150,7 @@ |
149 | 150 | autoLogin: autoLoginRef, |
150 | 151 | // openLoginVerify: openLoginVerifyRef, |
151 | 152 | title: globSetting && globSetting.title, |
153 | + logo, | |
152 | 154 | }; |
153 | 155 | }, |
154 | 156 | }); | ... | ... |
yarn.lock
... | ... | @@ -3331,9 +3331,9 @@ es-abstract@^1.18.0-next.0, es-abstract@^1.18.0-next.1: |
3331 | 3331 | string.prototype.trimstart "^1.0.1" |
3332 | 3332 | |
3333 | 3333 | es-module-lexer@^0.3.25: |
3334 | - version "0.3.25" | |
3335 | - resolved "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.3.25.tgz#24a1abcb9c5dc96923a8e42be033b801f788de06" | |
3336 | - integrity sha512-H9VoFD5H9zEfiOX2LeTWDwMvAbLqcAyA2PIb40TOAvGpScOjit02oTGWgIh+M0rx2eJOKyJVM9wtpKFVgnyC3A== | |
3334 | + version "0.3.26" | |
3335 | + resolved "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.3.26.tgz#7b507044e97d5b03b01d4392c74ffeb9c177a83b" | |
3336 | + integrity sha512-Va0Q/xqtrss45hWzP8CZJwzGSZJjDM5/MJRE3IXXnUCcVLElR9BRaE9F62BopysASyc4nM3uwhSW7FFB9nlWAA== | |
3337 | 3337 | |
3338 | 3338 | es-to-primitive@^1.2.1: |
3339 | 3339 | version "1.2.1" |
... | ... | @@ -3354,11 +3354,16 @@ esbuild-register@^1.1.0: |
3354 | 3354 | source-map-support "^0.5.19" |
3355 | 3355 | strip-json-comments "^3.1.1" |
3356 | 3356 | |
3357 | -esbuild@^0.7.17, esbuild@^0.7.19, esbuild@^0.7.21: | |
3357 | +esbuild@^0.7.17, esbuild@^0.7.19: | |
3358 | 3358 | version "0.7.21" |
3359 | 3359 | resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.7.21.tgz#e93f9d7e673cd5fcab2aab7774d489a0f680d657" |
3360 | 3360 | integrity sha512-qEnJdj+6Mdpt5kZwwCqO6PDNXSHNDDOPbnF4pduS3nub1v5GfgZfi8ysZ2DN4Q65WWgx6hz1a237ZETEHZpR0Q== |
3361 | 3361 | |
3362 | +esbuild@^0.7.21: | |
3363 | + version "0.7.22" | |
3364 | + resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.7.22.tgz#9149b903f8128b7c45a754046c24199d76bbe08e" | |
3365 | + integrity sha512-B43SYg8LGWYTCv9Gs0RnuLNwjzpuWOoCaZHTWEDEf5AfrnuDMerPVMdCEu7xOdhFvQ+UqfP2MGU9lxEy0JzccA== | |
3366 | + | |
3362 | 3367 | escalade@^3.1.0, escalade@^3.1.1: |
3363 | 3368 | version "3.1.1" |
3364 | 3369 | resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" |
... | ... | @@ -3557,22 +3562,7 @@ eventemitter3@^4.0.0: |
3557 | 3562 | resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" |
3558 | 3563 | integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== |
3559 | 3564 | |
3560 | -execa@^4.0.3: | |
3561 | - version "4.0.3" | |
3562 | - resolved "https://registry.npmjs.org/execa/-/execa-4.0.3.tgz#0a34dabbad6d66100bd6f2c576c8669403f317f2" | |
3563 | - integrity sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A== | |
3564 | - dependencies: | |
3565 | - cross-spawn "^7.0.0" | |
3566 | - get-stream "^5.0.0" | |
3567 | - human-signals "^1.1.1" | |
3568 | - is-stream "^2.0.0" | |
3569 | - merge-stream "^2.0.0" | |
3570 | - npm-run-path "^4.0.0" | |
3571 | - onetime "^5.1.0" | |
3572 | - signal-exit "^3.0.2" | |
3573 | - strip-final-newline "^2.0.0" | |
3574 | - | |
3575 | -execa@^4.1.0: | |
3565 | +execa@^4.0.3, execa@^4.1.0: | |
3576 | 3566 | version "4.1.0" |
3577 | 3567 | resolved "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" |
3578 | 3568 | integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== |
... | ... | @@ -4830,7 +4820,7 @@ jest-worker@^24.9.0: |
4830 | 4820 | merge-stream "^2.0.0" |
4831 | 4821 | supports-color "^6.1.0" |
4832 | 4822 | |
4833 | -jest-worker@^26.0.0, jest-worker@^26.2.1: | |
4823 | +jest-worker@^26.0.0: | |
4834 | 4824 | version "26.6.1" |
4835 | 4825 | resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.1.tgz#c2ae8cde6802cc14056043f997469ec170d9c32a" |
4836 | 4826 | integrity sha512-R5IE3qSGz+QynJx8y+ICEkdI2OJ3RJjRQVEyCcFAd3yVhQSEtquziPO29Mlzgn07LOVE8u8jhJ1FqcwegiXWOw== |
... | ... | @@ -4839,6 +4829,15 @@ jest-worker@^26.0.0, jest-worker@^26.2.1: |
4839 | 4829 | merge-stream "^2.0.0" |
4840 | 4830 | supports-color "^7.0.0" |
4841 | 4831 | |
4832 | +jest-worker@^26.2.1: | |
4833 | + version "26.6.2" | |
4834 | + resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" | |
4835 | + integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== | |
4836 | + dependencies: | |
4837 | + "@types/node" "*" | |
4838 | + merge-stream "^2.0.0" | |
4839 | + supports-color "^7.0.0" | |
4840 | + | |
4842 | 4841 | joycon@^2.2.5: |
4843 | 4842 | version "2.2.5" |
4844 | 4843 | resolved "https://registry.npmjs.org/joycon/-/joycon-2.2.5.tgz#8d4cf4cbb2544d7b7583c216fcdfec19f6be1615" |
... | ... | @@ -6902,9 +6901,9 @@ rollup-plugin-visualizer@^4.1.2: |
6902 | 6901 | yargs "^16.0.3" |
6903 | 6902 | |
6904 | 6903 | rollup-plugin-vue@^6.0.0-beta.10: |
6905 | - version "6.0.0-beta.10" | |
6906 | - resolved "https://registry.npmjs.org/rollup-plugin-vue/-/rollup-plugin-vue-6.0.0-beta.10.tgz#66d9b9a8dd2d085267d1cc398ea0113360879ac1" | |
6907 | - integrity sha512-8TZJmROiSRjWoHRR6id0/ktOBOUGuI302xDBq4YBiA/tnnXdoY3oFGtvRWzT5ldX0jTJ8QX40rrJOw2SvcWwxQ== | |
6904 | + version "6.0.0-beta.11" | |
6905 | + resolved "https://registry.npmjs.org/rollup-plugin-vue/-/rollup-plugin-vue-6.0.0-beta.11.tgz#fdbc6b7484a361ef8c5e8009cef4a6bd45435013" | |
6906 | + integrity sha512-osqLkFc7N76TOI0CeW0BOujlMFsMIoytyTRVUivaeYSMponNfk1iSuqyoeciUB3EjFqyL/dTTFPi+7rhaAm73w== | |
6908 | 6907 | dependencies: |
6909 | 6908 | debug "^4.1.1" |
6910 | 6909 | hash-sum "^2.0.0" | ... | ... |