feat: 菜单离线图标(未完成)
This commit is contained in:
@@ -99,7 +99,7 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<template #trigger>
|
||||
<div :class="[nsMenu.be('tooltip', 'trigger')]">
|
||||
<VbenIcon :class="nsMenu.e('icon')" :icon="menuIcon" fallback />
|
||||
<VbenIcon :class="nsMenu.e('icon')" :icon="menuIcon" offline />
|
||||
<slot></slot>
|
||||
<span v-if="collapseShowTitle" :class="nsMenu.e('name')">
|
||||
<slot name="title"></slot>
|
||||
@@ -114,7 +114,7 @@ onBeforeUnmount(() => {
|
||||
class="right-2"
|
||||
v-bind="props"
|
||||
/>
|
||||
<VbenIcon :class="nsMenu.e('icon')" :icon="menuIcon" />
|
||||
<VbenIcon :class="nsMenu.e('icon')" :icon="menuIcon" offline />
|
||||
<slot></slot>
|
||||
<slot name="title"></slot>
|
||||
</div>
|
||||
|
@@ -87,6 +87,7 @@ const iconArrowStyle = computed(() => {
|
||||
:class="nsMenu.e('icon')"
|
||||
:icon="icon"
|
||||
fallback
|
||||
offline
|
||||
/>
|
||||
|
||||
<div v-if="!hiddenTitle" :class="[e('title')]">
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { type Component, computed } from 'vue';
|
||||
|
||||
import { IconDefault, IconifyIcon } from '@vben-core/icons';
|
||||
import { IconDefault, IconifyIcon, IconifyOfflineIcon } from '@vben-core/icons';
|
||||
import {
|
||||
isFunction,
|
||||
isHttpUrl,
|
||||
@@ -13,6 +13,7 @@ const props = defineProps<{
|
||||
// 没有是否显示默认图标
|
||||
fallback?: boolean;
|
||||
icon?: Component | Function | string;
|
||||
offline?: boolean;
|
||||
}>();
|
||||
|
||||
const isRemoteIcon = computed(() => {
|
||||
@@ -28,6 +29,15 @@ const isComponent = computed(() => {
|
||||
<template>
|
||||
<component :is="icon as Component" v-if="isComponent" v-bind="$attrs" />
|
||||
<img v-else-if="isRemoteIcon" :src="icon as string" v-bind="$attrs" />
|
||||
<IconifyIcon v-else-if="icon" v-bind="$attrs" :icon="icon as string" />
|
||||
<IconifyOfflineIcon
|
||||
v-else-if="icon && offline"
|
||||
v-bind="$attrs"
|
||||
:icon="icon as string"
|
||||
/>
|
||||
<IconifyIcon
|
||||
v-else-if="icon && !offline"
|
||||
v-bind="$attrs"
|
||||
:icon="icon as string"
|
||||
/>
|
||||
<IconDefault v-else-if="fallback" v-bind="$attrs" />
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user