feat(projects): 引入soybean-admin-tab、去除vite-plugin-svg-icons,用unplugin-icons实现自定义svg的iconify写法、代码优化

This commit is contained in:
Soybean
2022-03-05 01:55:21 +08:00
parent b298af1ddb
commit a1a57a185c
93 changed files with 266 additions and 6700 deletions

View File

@@ -1,16 +1,16 @@
<template>
<div class="px-24px h-44px flex-y-center">
<span class="mr-14px">
<icon-ant-design:enter-outlined class="icon text-20px p-2px mr-3px" />
<icon-ant-design-enter-outlined class="icon text-20px p-2px mr-3px" />
确认
</span>
<span class="mr-14px">
<icon-mdi:arrow-up-thin class="icon text-20px p-2px mr-5px" />
<icon-mdi:arrow-down-thin class="icon text-20px p-2px mr-3px" />
<icon-mdi-arrow-up-thin class="icon text-20px p-2px mr-5px" />
<icon-mdi-arrow-down-thin class="icon text-20px p-2px mr-3px" />
切换
</span>
<span>
<icon-mdi:close class="icon text-20px p-2px mr-3px" />
<icon-mdi-close class="icon text-20px p-2px mr-3px" />
关闭
</span>
</div>

View File

@@ -10,7 +10,7 @@
>
<n-input ref="inputRef" v-model:value="keyword" clearable placeholder="请输入关键词搜索" @input="handleSearch">
<template #prefix>
<icon-uil:search class="text-15px text-[#c2c2c2]" />
<icon-uil-search class="text-15px text-[#c2c2c2]" />
</template>
</n-input>
<div class="mt-20px">
@@ -28,7 +28,7 @@ import { ref, shallowRef, computed, watch, nextTick } from 'vue';
import { useRouter } from 'vue-router';
import { useDebounceFn, onKeyStroke } from '@vueuse/core';
import { useRouteStore } from '@/store';
import type { RouteList } from './types';
import type { SearchMenu } from '@/interface';
import SearchResult from './SearchResult.vue';
import SearchFooter from './SearchFooter.vue';
@@ -41,15 +41,18 @@ interface Emits {
(e: 'update:value', val: boolean): void;
}
const props = withDefaults(defineProps<Props>(), {});
const props = defineProps<Props>();
const emit = defineEmits<Emits>();
const router = useRouter();
const routeStore = useRouteStore();
const keyword = ref('');
const activePath = ref('');
const resultOptions = shallowRef<RouteList[]>([]);
const inputRef = ref<HTMLInputElement | null>(null);
const resultOptions = shallowRef<SearchMenu[]>([]);
const inputRef = ref<HTMLInputElement>();
const handleSearch = useDebounceFn(search, 300);
const show = computed({
@@ -71,7 +74,7 @@ watch(show, async val => {
/** 查询 */
function search() {
resultOptions.value = routeStore.menusList.filter(
resultOptions.value = routeStore.searchMenus.filter(
menu => keyword.value && menu.meta?.title.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase().trim())
);
if (resultOptions.value?.length > 0) {

View File

@@ -13,7 +13,7 @@
>
<Icon :icon="item.meta?.icon ?? 'mdi:bookmark-minus-outline'" />
<span class="flex-1 ml-5px">{{ item.meta?.title }}</span>
<icon-ant-design:enter-outlined class="icon text-20px p-2px mr-3px" />
<icon-ant-design-enter-outlined class="icon text-20px p-2px mr-3px" />
</div>
</template>
</div>
@@ -24,11 +24,11 @@
import { computed } from 'vue';
import { Icon } from '@iconify/vue';
import { useThemeStore } from '@/store';
import type { RouteList } from './types';
import type { SearchMenu } from '@/interface';
interface Props {
value: string;
options: RouteList[];
options: SearchMenu[];
}
interface Emits {
@@ -36,9 +36,12 @@ interface Emits {
(e: 'enter'): void;
}
const props = withDefaults(defineProps<Props>(), {});
const props = defineProps<Props>();
const emit = defineEmits<Emits>();
const theme = useThemeStore();
const active = computed({
get() {
return props.value;
@@ -47,10 +50,9 @@ const active = computed({
emit('update:value', val);
}
});
const theme = useThemeStore();
/** 鼠标移入 */
async function handleMouse(item: RouteList) {
async function handleMouse(item: SearchMenu) {
active.value = item.path;
}

View File

@@ -1 +0,0 @@
export type RouteList = AuthRoute.Route;

View File

@@ -1,7 +1,7 @@
<template>
<div>
<hover-container tooltip-content="搜索" class="w-40px h-full" @click="handleSearch">
<icon-uil:search class="text-20px text-[#666]" />
<icon-uil-search class="text-20px text-[#666]" />
</hover-container>
<search-modal v-model:value="show" />
</div>
@@ -13,6 +13,7 @@ import { useBoolean } from '@/hooks';
import { SearchModal } from './components';
const { bool: show, toggle } = useBoolean();
function handleSearch() {
toggle();
}