From 600332e68355a1330fc358e3ae856047e77701d4 Mon Sep 17 00:00:00 2001 From: huangzheng Date: Sun, 2 Jun 2019 18:41:59 +0800 Subject: [PATCH] lint --- config/plugin.config.ts | 10 ++++++---- src/models/setting.ts | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config/plugin.config.ts b/config/plugin.config.ts index e142565d..1bef947e 100644 --- a/config/plugin.config.ts +++ b/config/plugin.config.ts @@ -46,7 +46,7 @@ export default (config: any) => { fileName: 'css/theme-colors.css', matchColors: getAntdSerials('#1890ff'), // 主色系列 // 改变样式选择器,解决样式覆盖问题 - changeSelector(selector) { + changeSelector(selector: string) { switch (selector) { case '.ant-calendar-today .ant-calendar-date': return ':not(.ant-calendar-selected-date)' + selector; @@ -103,10 +103,12 @@ export default (config: any) => { }); }; -function getAntdSerials(color) { +const getAntdSerials = (color: string) => { + const lightNum = 9; + const devide10 = 10; // 淡化(即less的tint) - const lightens = new Array(9).fill().map((t, i) => { - return ThemeColorReplacer.varyColor.lighten(color, i / 10); + const lightens = new Array(lightNum).fill().map((t, i) => { + return ThemeColorReplacer.varyColor.lighten(color, i / devide10); }); const colorPalettes = generate(color); return lightens.concat(colorPalettes); diff --git a/src/models/setting.ts b/src/models/setting.ts index 2b8e4a1d..2ba1469e 100644 --- a/src/models/setting.ts +++ b/src/models/setting.ts @@ -12,9 +12,11 @@ export interface SettingModelType { }; } -const updateTheme = (newPrimaryColor:string) => { - const hideMessage = message.loading('正在切换主题!', 0); - themeColorClient.changeColor(newPrimaryColor).finally(() => hideMessage()); +const updateTheme = (newPrimaryColor?: string) => { + const timeOut = 0; + const hideMessage = message.loading('正在切换主题!', timeOut); + themeColorClient.changeColor(newPrimaryColor) + .finally(() => hideMessage()); }; /* -- GitLab