mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-12 17:50:52 +08:00
添加按钮水波纹效果的自定义配置功能,支持默认、禁用、内嵌、抖动和欢乐五种样式。用户可在主题设置中选择不同效果,增强交互视觉体验。 - 在主题配置类型中添加 buttonWaveMode 字段 - 新增按钮水波纹配置组件和样式实现 - 更新中英文国际化文本 - 在应用配置中集成水波纹效果
61 lines
1.4 KiB
Vue
61 lines
1.4 KiB
Vue
<script lang="ts" setup>
|
|
import { computed } from 'vue';
|
|
|
|
import { useAntdDesignTokens } from '@vben/hooks';
|
|
import { preferences, usePreferences } from '@vben/preferences';
|
|
|
|
import { App, ConfigProvider, theme } from 'antdv-next';
|
|
|
|
import { antdLocale } from '#/locales';
|
|
|
|
import { waveConfigs } from './components/global/button-wave';
|
|
import { PopupContext } from './utils/context';
|
|
|
|
defineOptions({ name: 'App' });
|
|
|
|
const { isDark } = usePreferences();
|
|
const { tokens } = useAntdDesignTokens();
|
|
|
|
const tokenTheme = computed(() => {
|
|
const algorithm = isDark.value
|
|
? [theme.darkAlgorithm]
|
|
: [theme.defaultAlgorithm];
|
|
|
|
// antd 紧凑模式算法
|
|
if (preferences.app.compact) {
|
|
algorithm.push(theme.compactAlgorithm);
|
|
}
|
|
|
|
return {
|
|
algorithm,
|
|
token: tokens,
|
|
};
|
|
});
|
|
|
|
// 按钮水波纹样式配置
|
|
const waveConfig = computed(() => {
|
|
const { buttonWaveMode } = preferences.theme;
|
|
const found = waveConfigs.find((item) => item.name === buttonWaveMode);
|
|
return found ? found.wave : {};
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<ConfigProvider :locale="antdLocale" :theme="tokenTheme" :wave="waveConfig">
|
|
<App>
|
|
<RouterView />
|
|
<PopupContext />
|
|
</App>
|
|
</ConfigProvider>
|
|
</template>
|
|
|
|
<style lang="scss">
|
|
body {
|
|
/**
|
|
* 全局启用 抗锯齿字体
|
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-smooth
|
|
*/
|
|
@apply antialiased;
|
|
}
|
|
</style>
|