perf: 调整

This commit is contained in:
rd
2025-08-25 09:53:46 +08:00
parent a1c51cbca0
commit db9b53821b
3 changed files with 13 additions and 8 deletions

View File

@ -110,8 +110,8 @@ const props = defineProps({
default: () => [], default: () => [],
}, },
rowSelection: { rowSelection: {
type: Array, type: Object,
default: () => [], default: () => {},
}, },
selectedRowKeys: { selectedRowKeys: {
type: Array, type: Array,

View File

@ -19,7 +19,7 @@ export default defineComponent({
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const activeKey = ref('1'); const activeKey = ref('');
onMounted(() => { onMounted(() => {
activeKey.value = TABS.find((item) => item.routeName === route.name)?.key; activeKey.value = TABS.find((item) => item.routeName === route.name)?.key;
@ -34,7 +34,7 @@ export default defineComponent({
item.key === activeKey.value ? '!color-#6D4CFE font-500' : '' item.key === activeKey.value ? '!color-#6D4CFE font-500' : ''
}`} }`}
onClick={() => { onClick={() => {
activeKey.value = item.key; activeKey.value = '';
router.push({ name: item.routeName }); router.push({ name: item.routeName });
}} }}
> >
@ -42,7 +42,11 @@ export default defineComponent({
</p> </p>
))} ))}
</header> </header>
{activeKey.value === '1' ? <FinishedProducts /> : <RawMaterial />} {activeKey.value === '1' ? (
<FinishedProducts />
) : activeKey.value === '2' ? (
<RawMaterial />
) : null}
</div> </div>
); );
}, },

View File

@ -19,11 +19,12 @@ export default defineComponent({
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const activeKey = ref('1'); const activeKey = ref('');
onMounted(() => { onMounted(() => {
activeKey.value = TABS.find((item) => item.routeName === route.name)?.key; activeKey.value = TABS.find((item) => item.routeName === route.name)?.key;
}); });
return () => ( return () => (
<div class="material-center-wrap h-full flex flex-col"> <div class="material-center-wrap h-full flex flex-col">
<header class="py-16px px-24px rounded-8px bg-#fff flex items-center mb-16px"> <header class="py-16px px-24px rounded-8px bg-#fff flex items-center mb-16px">
@ -34,7 +35,7 @@ export default defineComponent({
item.key === activeKey.value ? '!color-#6D4CFE font-500' : '' item.key === activeKey.value ? '!color-#6D4CFE font-500' : ''
}`} }`}
onClick={() => { onClick={() => {
activeKey.value = item.key; activeKey.value = '';
router.push({ name: item.routeName }); router.push({ name: item.routeName });
}} }}
> >
@ -42,7 +43,7 @@ export default defineComponent({
</p> </p>
))} ))}
</header> </header>
{activeKey.value === '1' ? <FinishedProducts /> : <RawMaterial />} {activeKey.value === '1' ? <FinishedProducts /> : activeKey.value === '2' ? <RawMaterial /> : null}{' '}
</div> </div>
); );
}, },