Skip to content

Commit

Permalink
feat: add element ui icon
Browse files Browse the repository at this point in the history
  • Loading branch information
sukbearai committed Dec 20, 2024
1 parent d2c1410 commit 8a98628
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"uno-watch": "unocss -w"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@suwujs/preset": "workspace:*",
"@suwujs/utils": "workspace:*",
"element-plus": "catalog:"
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/XElButtonGroups/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defineProps(xElButtonGroupsProps)
<template>
<div class="mb-4">
<ElButton>Default</ElButton>
<ElButton type="primary">
<ElButton type="primary" icon="download">
Primary
</ElButton>
<ElButton type="success">
Expand Down
6 changes: 6 additions & 0 deletions packages/ui/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { App, Plugin } from 'vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { version } from '../package.json'

const INSTALLED_KEY = Symbol('X_DEV_TOOLS_UI_Installed')
Expand All @@ -8,6 +9,11 @@ export function createInstaller(components: Plugin[] = []) {
if ((app as any)[INSTALLED_KEY])
return

// Install ElementPlusIconsVue
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}

(app as any)[INSTALLED_KEY] = true
components.forEach(c => app.use(c))
}
Expand Down
95 changes: 93 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8a98628

Please sign in to comment.