style: 调整Icon悬停样式

This commit is contained in:
kailong321200875 2023-07-11 10:05:59 +08:00
parent 5312951359
commit 64c7e48bd1
7 changed files with 115 additions and 107 deletions

View File

@ -80,11 +80,13 @@ const dialogStyle = computed(() => {
class="cursor-pointer is-hover !h-54px mr-10px" class="cursor-pointer is-hover !h-54px mr-10px"
:icon="isFullscreen ? 'radix-icons:exit-full-screen' : 'radix-icons:enter-full-screen'" :icon="isFullscreen ? 'radix-icons:exit-full-screen' : 'radix-icons:enter-full-screen'"
color="var(--el-color-info)" color="var(--el-color-info)"
hover-color="var(--el-color-primary)"
@click="toggleFull" @click="toggleFull"
/> />
<Icon <Icon
class="cursor-pointer is-hover !h-54px" class="cursor-pointer is-hover !h-54px"
icon="ep:close" icon="ep:close"
hover-color="var(--el-color-primary)"
color="var(--el-color-info)" color="var(--el-color-info)"
@click="close" @click="close"
/> />
@ -127,14 +129,4 @@ const dialogStyle = computed(() => {
top: 0; top: 0;
} }
} }
.is-hover {
&:hover {
span,
i,
svg {
color: var(--el-color-primary) !important;
}
}
}
</style> </style>

View File

@ -15,7 +15,8 @@ const props = defineProps({
// icon color // icon color
color: propTypes.string, color: propTypes.string,
// icon size // icon size
size: propTypes.number.def(16) size: propTypes.number.def(16),
hoverColor: propTypes.string
}) })
const elRef = ref<ElRef>(null) const elRef = ref<ElRef>(null)
@ -74,3 +75,15 @@ watch(
<span v-else ref="elRef" class="iconify" :data-icon="symbolId" :style="getIconifyStyle"></span> <span v-else ref="elRef" class="iconify" :data-icon="symbolId" :style="getIconifyStyle"></span>
</ElIcon> </ElIcon>
</template> </template>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-icon';
.@{prefix-cls} {
&:hover {
svg {
color: v-bind(hoverColor) !important;
}
}
}
</style>

View File

@ -2,4 +2,5 @@ export interface IconTypes {
size?: number size?: number
color?: string color?: string
icon: string icon: string
hoverColor?: string
} }

View File

@ -7,6 +7,7 @@ import type { TableProps, TableColumn, Pagination, TableSetProps } from './types
import { set } from 'lodash-es' import { set } from 'lodash-es'
import { CSSProperties } from 'vue' import { CSSProperties } from 'vue'
import { getSlot } from '@/utils/tsxHelper' import { getSlot } from '@/utils/tsxHelper'
import { Icon } from '@/components/Icon'
export default defineComponent({ export default defineComponent({
name: 'Table', name: 'Table',
@ -400,25 +401,36 @@ export default defineComponent({
}) })
} }
return () => ( return () => {
<div v-loading={unref(getProps).loading}> const tableSlots = {}
<ElTable ref={elTableRef} data={unref(getProps).data} {...unref(getBindValue)}> if (getSlot(slots, 'empty')) {
{{ tableSlots['empty'] = (...args: any[]) => getSlot(slots, 'empty', args)
default: () => renderTableColumn(), }
empty: () => getSlot(slots, 'empty') || unref(getProps).emptyText, if (getSlot(slots, 'append')) {
append: () => getSlot(slots, 'append') tableSlots['append'] = (...args: any[]) => getSlot(slots, 'append', args)
}} }
</ElTable> return (
{unref(getProps).pagination ? ( <div v-loading={unref(getProps).loading}>
<ElPagination <div>
v-model:pageSize={pageSizeRef.value} <Icon icon="ant-design:sync-outlined" class="cursor-pointer" />
v-model:currentPage={currentPageRef.value} </div>
class="mt-10px" <ElTable ref={elTableRef} data={unref(getProps).data} {...unref(getBindValue)}>
{...unref(pagination)} {{
></ElPagination> default: () => renderTableColumn(),
) : undefined} ...tableSlots
</div> }}
) </ElTable>
{unref(getProps).pagination ? (
<ElPagination
v-model:pageSize={pageSizeRef.value}
v-model:currentPage={currentPageRef.value}
class="mt-10px"
{...unref(pagination)}
></ElPagination>
) : undefined}
</div>
)
}
} }
}) })
</script> </script>

View File

@ -35,6 +35,8 @@ const appStore = useAppStore()
const tagsViewIcon = computed(() => appStore.getTagsViewIcon) const tagsViewIcon = computed(() => appStore.getTagsViewIcon)
const isDark = computed(() => appStore.getIsDark)
// tag // tag
const initTags = () => { const initTags = () => {
affixTagArr.value = filterAffixTags(unref(routers)) affixTagArr.value = filterAffixTags(unref(routers))
@ -270,7 +272,8 @@ watch(
> >
<Icon <Icon
icon="ep:d-arrow-left" icon="ep:d-arrow-left"
:color="appStore.getIsDark ? 'var(--el-text-color-regular)' : '#333'" color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
/> />
</span> </span>
<div class="overflow-hidden flex-1"> <div class="overflow-hidden flex-1">
@ -368,6 +371,7 @@ watch(
<Icon <Icon
:class="`${prefixCls}__item--close`" :class="`${prefixCls}__item--close`"
color="#333" color="#333"
hover-color="var(--el-color-white)"
icon="ant-design:close-outlined" icon="ant-design:close-outlined"
:size="12" :size="12"
@click.prevent.stop="closeSelectedTag(item)" @click.prevent.stop="closeSelectedTag(item)"
@ -386,7 +390,8 @@ watch(
> >
<Icon <Icon
icon="ep:d-arrow-right" icon="ep:d-arrow-right"
:color="appStore.getIsDark ? 'var(--el-text-color-regular)' : '#333'" color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
/> />
</span> </span>
<span <span
@ -396,7 +401,8 @@ watch(
> >
<Icon <Icon
icon="ant-design:reload-outlined" icon="ant-design:reload-outlined"
:color="appStore.getIsDark ? 'var(--el-text-color-regular)' : '#333'" color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
/> />
</span> </span>
<ContextMenu <ContextMenu
@ -459,7 +465,8 @@ watch(
> >
<Icon <Icon
icon="ant-design:setting-outlined" icon="ant-design:setting-outlined"
:color="appStore.getIsDark ? 'var(--el-text-color-regular)' : '#333'" color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
/> />
</span> </span>
</ContextMenu> </ContextMenu>
@ -476,7 +483,7 @@ watch(
&__tool { &__tool {
position: relative; position: relative;
&:after { &:before {
position: absolute; position: absolute;
top: 1px; top: 1px;
left: 0; left: 0;
@ -487,27 +494,17 @@ watch(
} }
&--first { &--first {
&:after {
display: none;
}
&:before { &:before {
position: absolute; position: absolute;
top: 1px; top: 1px;
left: 0; left: 0;
width: 100%; width: 100%;
height: calc(~'100% - 1px'); height: calc(~'100% - 1px');
border-left: none;
border-right: 1px solid var(--el-border-color); border-right: 1px solid var(--el-border-color);
content: ''; content: '';
} }
} }
&:hover {
:deep(span),
:deep(i),
:deep(svg) {
color: var(--el-color-black) !important;
}
}
} }
&__item { &__item {
@ -546,7 +543,7 @@ watch(
background-color: var(--el-color-primary); background-color: var(--el-color-primary);
border: 1px solid var(--el-color-primary); border: 1px solid var(--el-color-primary);
.@{prefix-cls}__item--close { .@{prefix-cls}__item--close {
:deep(span) { :deep(svg) {
color: var(--el-color-white) !important; color: var(--el-color-white) !important;
} }
} }
@ -556,14 +553,6 @@ watch(
.dark { .dark {
.@{prefix-cls} { .@{prefix-cls} {
&__tool { &__tool {
&:hover {
:deep(span),
:deep(i),
:deep(svg) {
color: #fff !important;
}
}
&--first { &--first {
&:after { &:after {
display: none; display: none;
@ -586,7 +575,7 @@ watch(
background-color: var(--el-color-primary); background-color: var(--el-color-primary);
border: 1px solid var(--el-color-primary); border: 1px solid var(--el-color-primary);
.@{prefix-cls}__item--close { .@{prefix-cls}__item--close {
:deep(span) { :deep(svg) {
color: var(--el-color-white) !important; color: var(--el-color-white) !important;
} }
} }

View File

@ -7,6 +7,7 @@ import { underlineToHump } from '@/utils'
import { useAppStore } from '@/store/modules/app' import { useAppStore } from '@/store/modules/app'
import { useDesign } from '@/hooks/web/useDesign' import { useDesign } from '@/hooks/web/useDesign'
import { ref } from 'vue' import { ref } from 'vue'
import { ElScrollbar } from 'element-plus'
const { getPrefixCls } = useDesign() const { getPrefixCls } = useDesign()
@ -32,60 +33,62 @@ const toLogin = () => {
:class="prefixCls" :class="prefixCls"
class="h-[100%] relative lt-xl:bg-[var(--login-bg-color)] lt-sm:px-10px lt-xl:px-10px lt-md:px-10px" class="h-[100%] relative lt-xl:bg-[var(--login-bg-color)] lt-sm:px-10px lt-xl:px-10px lt-md:px-10px"
> >
<div class="relative h-full flex mx-auto"> <ElScrollbar class="h-full">
<div <div class="relative flex mx-auto">
:class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden`"
>
<div class="flex items-center relative text-white">
<img src="@/assets/imgs/logo.png" alt="" class="w-48px h-48px mr-10px" />
<span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
</div>
<div class="flex justify-center items-center h-[calc(100%-60px)]">
<TransitionGroup
appear
tag="div"
enter-active-class="animate__animated animate__bounceInLeft"
>
<img src="@/assets/svgs/login-box-bg.svg" key="1" alt="" class="w-350px" />
<div class="text-3xl text-white" key="2">{{ t('login.welcome') }}</div>
<div class="mt-5 font-normal text-white text-14px" key="3">
{{ t('login.message') }}
</div>
</TransitionGroup>
</div>
</div>
<div class="flex-1 p-30px lt-sm:p-10px dark:bg-[var(--login-bg-color)] relative">
<div <div
class="flex justify-between items-center text-white at-2xl:justify-end at-xl:justify-end" :class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden`"
> >
<div class="flex items-center at-2xl:hidden at-xl:hidden"> <div class="flex items-center relative text-white">
<img src="@/assets/imgs/logo.png" alt="" class="w-48px h-48px mr-10px" /> <img src="@/assets/imgs/logo.png" alt="" class="w-48px h-48px mr-10px" />
<span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span> <span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
</div> </div>
<div class="flex justify-center items-center h-[calc(100%-60px)]">
<div class="flex justify-end items-center space-x-10px"> <TransitionGroup
<ThemeSwitch /> appear
<LocaleDropdown class="lt-xl:text-white dark:text-white" /> tag="div"
enter-active-class="animate__animated animate__bounceInLeft"
>
<img src="@/assets/svgs/login-box-bg.svg" key="1" alt="" class="w-350px" />
<div class="text-3xl text-white" key="2">{{ t('login.welcome') }}</div>
<div class="mt-5 font-normal text-white text-14px" key="3">
{{ t('login.message') }}
</div>
</TransitionGroup>
</div> </div>
</div> </div>
<Transition appear enter-active-class="animate__animated animate__bounceInRight"> <div class="flex-1 p-30px lt-sm:p-10px dark:bg-[var(--login-bg-color)] relative">
<div <div
class="h-full flex items-center m-auto w-[100%] at-2xl:max-w-500px at-xl:max-w-500px at-md:max-w-500px at-lg:max-w-500px" class="flex justify-between items-center text-white at-2xl:justify-end at-xl:justify-end"
> >
<LoginForm <div class="flex items-center at-2xl:hidden at-xl:hidden">
v-if="isLogin" <img src="@/assets/imgs/logo.png" alt="" class="w-48px h-48px mr-10px" />
class="p-20px h-auto m-auto lt-xl:rounded-3xl lt-xl:light:bg-white" <span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
@to-register="toRegister" </div>
/>
<RegisterForm <div class="flex justify-end items-center space-x-10px">
v-else <ThemeSwitch />
class="p-20px h-auto m-auto lt-xl:rounded-3xl lt-xl:light:bg-white" <LocaleDropdown class="lt-xl:text-white dark:text-white" />
@to-login="toLogin" </div>
/>
</div> </div>
</Transition> <Transition appear enter-active-class="animate__animated animate__bounceInRight">
<div
class="h-full flex items-center m-auto w-[100%] at-2xl:max-w-500px at-xl:max-w-500px at-md:max-w-500px at-lg:max-w-500px"
>
<LoginForm
v-if="isLogin"
class="p-20px h-auto m-auto lt-xl:rounded-3xl lt-xl:light:bg-white"
@to-register="toRegister"
/>
<RegisterForm
v-else
class="p-20px h-auto m-auto lt-xl:rounded-3xl lt-xl:light:bg-white"
@to-login="toLogin"
/>
</div>
</Transition>
</div>
</div> </div>
</div> </ElScrollbar>
</div> </div>
</template> </template>

View File

@ -146,23 +146,27 @@ const schema = reactive<FormSchema[]>([
size={iconSize} size={iconSize}
class="cursor-pointer ant-icon" class="cursor-pointer ant-icon"
color={iconColor} color={iconColor}
hoverColor={hoverColor}
/> />
<Icon <Icon
icon="ant-design:wechat-filled" icon="ant-design:wechat-filled"
size={iconSize} size={iconSize}
class="cursor-pointer ant-icon" class="cursor-pointer ant-icon"
color={iconColor} color={iconColor}
hoverColor={hoverColor}
/> />
<Icon <Icon
icon="ant-design:alipay-circle-filled" icon="ant-design:alipay-circle-filled"
size={iconSize} size={iconSize}
color={iconColor} color={iconColor}
hoverColor={hoverColor}
class="cursor-pointer ant-icon" class="cursor-pointer ant-icon"
/> />
<Icon <Icon
icon="ant-design:weibo-circle-filled" icon="ant-design:weibo-circle-filled"
size={iconSize} size={iconSize}
color={iconColor} color={iconColor}
hoverColor={hoverColor}
class="cursor-pointer ant-icon" class="cursor-pointer ant-icon"
/> />
</div> </div>
@ -185,6 +189,8 @@ const loading = ref(false)
const iconColor = '#999' const iconColor = '#999'
const hoverColor = 'var(--el-color-primary)'
const redirect = ref<string>('') const redirect = ref<string>('')
watch( watch(
@ -280,11 +286,3 @@ const toRegister = () => {
@register="formRegister" @register="formRegister"
/> />
</template> </template>
<style lang="less" scoped>
:deep(.ant-icon) {
& > svg:hover {
color: var(--el-color-primary) !important;
}
}
</style>