Skip to content

Commit ac552ee

Browse files
committed
feat: Add unocss preset icons
1 parent 8d4b391 commit ac552ee

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"Vue.volar",
44
"antfu.unocss",
55
"simonhe.common-intellisense",
6-
"lokalise.i18n-ally"
6+
"lokalise.i18n-ally",
7+
"antfu.iconify"
78
]
89
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
},
3838
"devDependencies": {
3939
"@antfu/eslint-config": "2.12.1",
40+
"@iconify-json/carbon": "^1.1.31",
4041
"@intlify/unplugin-vue-i18n": "^4.0.0",
4142
"@types/lodash-es": "^4.17.12",
4243
"@types/node": "^20.12.3",

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/TabBar.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ const active = ref(0)
55

66
<template>
77
<van-tabbar v-model="active" route>
8-
<van-tabbar-item replace icon="home-o" to="/">
8+
<van-tabbar-item replace to="/">
99
{{ t('layouts.home') }}
10+
<template #icon>
11+
<div class="i-carbon:home" />
12+
</template>
1013
</van-tabbar-item>
11-
<van-tabbar-item replace icon="user-circle-o" to="/profile">
14+
<van-tabbar-item replace to="/profile">
1215
{{ t('layouts.profile') }}
16+
<template #icon>
17+
<div class="i-carbon:user" />
18+
</template>
1319
</van-tabbar-item>
1420
</van-tabbar>
1521
</template>

uno.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { defineConfig, presetAttributify, presetMini, presetUno } from 'unocss'
1+
import {
2+
defineConfig,
3+
presetAttributify,
4+
presetIcons,
5+
presetMini,
6+
presetUno,
7+
} from 'unocss'
8+
29
import presetRemToPx from '@unocss/preset-rem-to-px'
310

411
// 刚使用unocss的朋友,可以借助这个工具: https://to-unocss.netlify.app
@@ -7,6 +14,7 @@ export default defineConfig({
714
presets: [
815
presetUno,
916
presetAttributify,
17+
presetIcons(),
1018
// 为什么要用到这个插件?
1119
// 模板使用 viewport 作为移动端适配方案,unocss 默认单位为 rem
1220
// 所以需要转成 px,然后由 postcss 把 px 转成 vw/vh,完成适配

0 commit comments

Comments
 (0)