build(projects): update tsconfig、eslintrc

This commit is contained in:
Soybean
2022-03-12 16:21:40 +08:00
parent 4093dcd6dc
commit 75de2b0604
131 changed files with 1174 additions and 1140 deletions

View File

@ -22,7 +22,7 @@ interface Props {
}
withDefaults(defineProps<Props>(), {
showPadding: true
showPadding: true,
});
const app = useAppStore();

View File

@ -20,17 +20,17 @@ const options = [
{
label: '用户中心',
key: 'user-center',
icon: iconifyRender('carbon:user-avatar')
icon: iconifyRender('carbon:user-avatar'),
},
{
type: 'divider',
key: 'divider'
key: 'divider',
},
{
label: '退出登录',
key: 'logout',
icon: iconifyRender('carbon:logout')
}
icon: iconifyRender('carbon:logout'),
},
];
function handleDropdown(optionKey: string) {
@ -43,7 +43,7 @@ function handleDropdown(optionKey: string) {
negativeText: '取消',
onPositiveClick: () => {
auth.resetAuthStore();
}
},
});
}
}

View File

@ -31,7 +31,7 @@ import {
GithubSite,
FullScreen,
ThemeMode,
UserAvatar
UserAvatar,
} from './components';
interface Props {

View File

@ -61,10 +61,10 @@ const show = computed({
},
set(val: boolean) {
emit('update:value', val);
}
},
});
watch(show, async val => {
watch(show, async (val) => {
if (val) {
/** 自动聚焦 */
await nextTick();
@ -75,7 +75,7 @@ watch(show, async val => {
/** 查询 */
function search() {
resultOptions.value = routeStore.searchMenus.filter(
menu => keyword.value && menu.meta?.title.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase().trim())
(menu) => keyword.value && menu.meta?.title.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase().trim())
);
if (resultOptions.value?.length > 0) {
activePath.value = resultOptions.value[0].path;
@ -97,7 +97,7 @@ function handleClose() {
function handleUp() {
const { length } = resultOptions.value;
if (length === 0) return;
const index = resultOptions.value.findIndex(item => item.path === activePath.value);
const index = resultOptions.value.findIndex((item) => item.path === activePath.value);
if (index === 0) {
activePath.value = resultOptions.value[length - 1].path;
} else {
@ -109,7 +109,7 @@ function handleUp() {
function handleDown() {
const { length } = resultOptions.value;
if (length === 0) return;
const index = resultOptions.value.findIndex(item => item.path === activePath.value);
const index = resultOptions.value.findIndex((item) => item.path === activePath.value);
if (index + 1 === length) {
activePath.value = resultOptions.value[0].path;
} else {
@ -121,8 +121,8 @@ function handleDown() {
function handleEnter() {
const { length } = resultOptions.value;
if (length === 0 || activePath.value === '') return;
const item = resultOptions.value.find(item => item.path === activePath.value);
if (item?.meta?.href) {
const routeItem = resultOptions.value.find((item) => item.path === activePath.value);
if (routeItem?.meta?.href) {
window.open(activePath.value, '__blank');
} else {
router.push(activePath.value);

View File

@ -6,7 +6,7 @@
class="bg-[#e5e7eb] dark:bg-dark h-56px mt-8px px-14px rounded-4px cursor-pointer flex-y-center justify-between"
:style="{
background: item.path === active ? theme.themeColor : '',
color: item.path === active ? '#fff' : ''
color: item.path === active ? '#fff' : '',
}"
@click="handleTo"
@mouseenter="handleMouse(item)"
@ -48,7 +48,7 @@ const active = computed({
},
set(val: string) {
emit('update:value', val);
}
},
});
/** 鼠标移入 */

View File

@ -35,7 +35,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {
icon: undefined,
isMini: false
isMini: false,
});
const { bool: isHover, setTrue, setFalse } = useBoolean();

View File

@ -44,7 +44,7 @@ function setActiveParentRouteName(routeName: string) {
}
const firstDegreeMenus = computed(() =>
routeStore.menus.map(item => {
routeStore.menus.map((item) => {
const { routeName, label } = item;
const icon = item?.icon;
const hasChildren = Boolean(item.children && item.children.length);
@ -53,13 +53,13 @@ const firstDegreeMenus = computed(() =>
routeName,
label,
icon,
hasChildren
hasChildren,
};
})
);
function getActiveParentRouteName() {
firstDegreeMenus.value.some(item => {
firstDegreeMenus.value.some((item) => {
const routeName = route.name as string;
const flag = routeName?.includes(item.routeName);
if (flag) {
@ -85,10 +85,10 @@ function resetFirstDegreeMenus() {
const activeChildMenus = computed(() => {
const menus: GlobalMenuOption[] = [];
routeStore.menus.some(item => {
routeStore.menus.some((item) => {
const flag = item.routeName === activeParentRouteName.value && Boolean(item.children?.length);
if (flag) {
menus.push(...item.children!);
menus.push(...(item.children || []));
}
return flag;
});

View File

@ -38,7 +38,7 @@ type Option = DropdownOption & {
const props = withDefaults(defineProps<Props>(), {
visible: false,
currentPath: ''
currentPath: '',
});
const emit = defineEmits<Emits>();
@ -52,7 +52,7 @@ const dropdownVisible = computed({
},
set(visible: boolean) {
emit('update:visible', visible);
}
},
});
function hide() {
@ -64,29 +64,29 @@ const options = computed<Option[]>(() => [
label: '重新加载',
key: 'reload-current',
disabled: props.currentPath !== tab.activeTab,
icon: iconifyRender('ant-design:reload-outlined')
icon: iconifyRender('ant-design:reload-outlined'),
},
{
label: '关闭',
key: 'close-current',
disabled: props.currentPath === tab.homeTab.path,
icon: iconifyRender('ant-design:close-outlined')
icon: iconifyRender('ant-design:close-outlined'),
},
{
label: '关闭其他',
key: 'close-other',
icon: iconifyRender('ant-design:column-width-outlined')
icon: iconifyRender('ant-design:column-width-outlined'),
},
{
label: '关闭左侧',
key: 'close-left',
icon: iconifyRender('mdi:format-horizontal-align-left')
icon: iconifyRender('mdi:format-horizontal-align-left'),
},
{
label: '关闭右侧',
key: 'close-right',
icon: iconifyRender('mdi:format-horizontal-align-right')
}
icon: iconifyRender('mdi:format-horizontal-align-right'),
},
]);
const actionMap = new Map<DropdownKey, () => void>([
@ -94,32 +94,32 @@ const actionMap = new Map<DropdownKey, () => void>([
'reload-current',
() => {
app.reloadPage();
}
},
],
[
'close-current',
() => {
tab.removeTab(props.currentPath);
}
},
],
[
'close-other',
() => {
tab.clearTab([props.currentPath]);
}
},
],
[
'close-left',
() => {
tab.clearLeftTab(props.currentPath);
}
},
],
[
'close-right',
() => {
tab.clearRightTab(props.currentPath);
}
]
},
],
]);
function handleDropdown(optionKey: string) {

View File

@ -64,7 +64,7 @@ const dropdown = reactive({
visible: false,
x: 0,
y: 0,
currentPath: ''
currentPath: '',
});
function showDropdown() {
dropdown.visible = true;
@ -92,7 +92,7 @@ watch(
getActiveTabClientX();
},
{
immediate: true
immediate: true,
}
);

View File

@ -45,23 +45,23 @@ const layoutConfig: LayoutConfig = {
vertical: {
placement: 'bottom-start',
menuClass: 'w-1/3 h-full',
mainClass: 'w-2/3 h-3/4'
mainClass: 'w-2/3 h-3/4',
},
'vertical-mix': {
placement: 'bottom',
menuClass: 'w-1/4 h-full',
mainClass: 'w-2/3 h-3/4'
mainClass: 'w-2/3 h-3/4',
},
horizontal: {
placement: 'bottom',
menuClass: 'w-full h-1/4',
mainClass: 'w-full h-3/4'
mainClass: 'w-full h-3/4',
},
'horizontal-mix': {
placement: 'bottom-end',
menuClass: 'w-full h-1/4',
mainClass: 'w-2/3 h-3/4'
}
mainClass: 'w-2/3 h-3/4',
},
};
const activeConfig = computed(() => layoutConfig[props.mode]);

View File

@ -17,7 +17,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
iconClass: 'text-14px'
iconClass: 'text-14px',
});
const whiteColors = ['#ffffff', '#fff', 'rgb(255,255,255)'];

View File

@ -30,12 +30,13 @@ function handleResetConfig() {
}
function clipboardEventListener() {
const copy = new Clipboard(copyRef.value!);
if (!copyRef.value) return;
const copy = new Clipboard(copyRef.value);
copy.on('success', () => {
window.$dialog?.success({
title: '操作成功',
content: '复制成功,请替换 src/settings/theme.json的内容',
positiveText: '确定'
positiveText: '确定',
});
});
}