Skip to content

Commit 25760fc

Browse files
committed
feat: update icon
1 parent f746047 commit 25760fc

File tree

8 files changed

+91
-63
lines changed

8 files changed

+91
-63
lines changed

package-lock.json

Lines changed: 40 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
},
3232
"devDependencies": {
3333
"@commitlint/config-conventional": "16.2.4",
34+
"@unocss/preset-rem-to-px": "0.45.1",
3435
"@types/node": "17.0.23",
3536
"@types/nprogress": "0.2.0",
3637
"@typescript-eslint/eslint-plugin": "4.15.1",

src/components/base/Icon.vue

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/components/base/TreeMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<template v-for="menu in menus" :key="menu.path">
33
<el-sub-menu v-if="menu.children && menu.children.length > 0" :index="menu.path">
44
<template #title>
5-
<Icon :icon="menu.meta.icon" />
5+
<div :class="[menu.meta.icon, 'mr10']" />
66
<span>{{ lastItem(menu.meta.title) }}</span>
77
</template>
88
<TreeMenu :menus="menu.children"></TreeMenu>
99
</el-sub-menu>
1010
<el-menu-item v-else :index="menu.path">
11-
<Icon :icon="menu.meta.icon" />
11+
<div :class="[menu.meta.icon, 'mr10']" />
1212
<template #title>{{ lastItem(menu.meta.title) }}</template>
1313
</el-menu-item>
1414
</template>

src/components/layout/Header.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
<div class="breadcrumb">
33
<div class="flex items-center">
44
<div class="collapse-icon" @click="updateCollapse">
5-
<Icon
6-
:icon="isCollapse ? 'foundation-indent-less' : 'foundation-indent-more'"
7-
w="w30"
8-
h="h30"
5+
<div
6+
:class="[
7+
isCollapse ? 'foundation-indent-less' : 'foundation-indent-more',
8+
'w30',
9+
'h30',
10+
'mx10',
11+
]"
912
/>
1013
</div>
1114
<el-breadcrumb separator="/">

src/styles/base.scss

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,29 @@
1-
body {
2-
margin: 0;
3-
}
4-
#app {
5-
height: 100vh;
6-
background: #fafafa;
7-
}
8-
a {
9-
text-decoration: none;
10-
color: #409eff;
11-
}
12-
.icon {
13-
margin-right: 10px;
14-
cursor: pointer;
15-
font-size: 20px;
16-
}
17-
::-webkit-scrollbar {
18-
/* 滚动条整体样式 */
19-
width: 5px; /* 高宽分别对应横竖滚动条的尺寸 */
20-
height: 5px;
21-
}
22-
::-webkit-scrollbar-track {
23-
/* 滚动条里面轨道 */
24-
border-radius: 5px;
25-
background: #fafafa;
26-
}
27-
::-webkit-scrollbar-thumb {
28-
/* 滚动条里面小方块 */
29-
border-radius: 5px;
30-
background: #dfdfdf;
31-
&:hover {
32-
background: #cfcfcf;
33-
}
34-
}
1+
body {
2+
margin: 0;
3+
}
4+
#app {
5+
height: 100vh;
6+
background: #fafafa;
7+
}
8+
a {
9+
text-decoration: none;
10+
color: #409eff;
11+
}
12+
::-webkit-scrollbar {
13+
/* 滚动条整体样式 */
14+
width: 5px; /* 高宽分别对应横竖滚动条的尺寸 */
15+
height: 5px;
16+
}
17+
::-webkit-scrollbar-track {
18+
/* 滚动条里面轨道 */
19+
border-radius: 5px;
20+
background: #fafafa;
21+
}
22+
::-webkit-scrollbar-thumb {
23+
/* 滚动条里面小方块 */
24+
border-radius: 5px;
25+
background: #dfdfdf;
26+
&:hover {
27+
background: #cfcfcf;
28+
}
29+
}

src/views/dashboard/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div @click="updateName('333')">updateName</div>
99
<el-button class="m10 w200 br10 c-#387">I am ElButton</el-button>
1010
<el-date-picker v-model="dateVal" type="date" placeholder="Pick a day" />
11-
<Icon v-for="icon in icons" :key="icon" :icon="icon" />
11+
<div v-for="icon in icons" :key="icon" :class="icon" />
1212
<div @click="getTest">getTest</div>
1313
<div @click="postTest">postTest</div>
1414
<div @click="setUserInfo({ name: 'allen', token: String(Math.random()) })">setUserInfo</div>
@@ -30,7 +30,7 @@ const { userInfo, setUserInfo } = useStore('user')
3030
3131
const dateVal = ref(new Date())
3232
33-
const icons = ['foundation-indent-more', 'foundation-indent-less', '']
33+
const icons = ['foundation-indent-more', 'foundation-indent-less']
3434
3535
async function getTest() {
3636
const res = await apiTest.getTest({ a: 1 })

unocss.config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineConfig, presetAttributify, presetIcons, presetUno, Rule } from 'unocss'
1+
import presetRemToPx from '@unocss/preset-rem-to-px'
2+
import { defineConfig, Preset, presetAttributify, presetIcons, presetUno, Rule } from 'unocss'
23
// https://github.com/unocss/unocss
34

45
const sizeMapping: Record<string, string> = {
@@ -32,8 +33,15 @@ export const createConfig = () => {
3233
presetAttributify(),
3334
presetIcons({
3435
prefix: '',
35-
// autoInstall: true,
36+
extraProperties: {
37+
display: 'inline-block',
38+
cursor: 'pointer',
39+
'font-size': '20px',
40+
},
3641
}),
42+
presetRemToPx({
43+
baseFontSize: 4,
44+
}) as Preset,
3745
],
3846
include: [/\.vue$/, /pages.json$/],
3947
rules: getSizeRules(sizeMapping),

0 commit comments

Comments
 (0)