File tree Expand file tree Collapse file tree
src/client/webcomponents/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export default defineConfig({
3535 setup ( ctx ) {
3636 ctx . docks . register ( {
3737 title : 'Local' ,
38- icon : 'https://upload.wikimedia.org/wikipedia/commons/9/95/Vue.js_Logo_2.svg ' ,
38+ icon : 'logos:vue ' ,
3939 id : 'local' ,
4040 type : 'iframe' ,
4141 url : 'https://antfu.me' ,
@@ -50,7 +50,7 @@ export default defineConfig({
5050 } ) ,
5151 id : 'local2' ,
5252 title : 'Local2' ,
53- icon : 'https://upload.wikimedia.org/wikipedia/commons/9/95/Vue.js_Logo_2.svg ' ,
53+ icon : 'material-symbols-light:add-alert ' ,
5454 } )
5555 } ,
5656 } ,
Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import type { DevToolsDockEntry } from ' @vitejs/devtools-kit'
33import { toRefs } from ' vue'
4+ import DockIcon from ' ./DockIcon.vue'
45
56const props = defineProps <{
67 selected? : DevToolsDockEntry
@@ -40,12 +41,7 @@ function toggleDockEntry(dock: DevToolsDockEntry) {
4041 class =" flex items-center justify-center p1.5 rounded-xl hover:bg-[#8881] hover:scale-120 transition-all duration-300 relative"
4142 @click =" toggleDockEntry(dock)"
4243 >
43- <img
44- :src =" dock.icon"
45- :alt =" dock.title"
46- class =" w-5 h-5 select-none"
47- draggable =" false"
48- >
44+ <DockIcon :icon =" dock.icon" :title =" dock.title" class =" w-5 h-5 select-none" />
4945 </button >
5046 <div class =" vite-devtools-dock-label text-xs group-hover:opacity-100 opacity-0 transition-opacity duration-300 w-max bg-glass border border-base z-10 rounded px2 absolute p1" >
5147 {{ dock.title }}
Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ defineProps <{
3+ icon: string
4+ title? : string
5+ }>()
6+
7+ function getIconUrl(str : string , color : ' dark' | ' light' ) {
8+ if (str .includes (' /' ))
9+ return str
10+ const match = str .match (/ ^ ([\w -] + ):([\w -] + )$ / )
11+ if (match ) {
12+ const [, collection, icon] = match
13+ return ` https://api.iconify.design/${collection }/${icon }.svg${color === ' dark' ? ' ?color=%23eee' : ' ?color=%23111' } `
14+ }
15+ return str
16+ }
17+ </script >
18+
19+ <template >
20+ <img
21+ :src =" getIconUrl(icon, 'dark')"
22+ :alt =" title"
23+ draggable =" false"
24+ >
25+ </template >
You can’t perform that action at this time.
0 commit comments