Skip to content

Commit 4e528ba

Browse files
committed
refactor: home page
1 parent dbfe87b commit 4e528ba

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

src/components/Container.vue

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
<script setup lang="ts">
2-
defineProps({
3-
paddingX: {
4-
type: Number,
5-
default: 16,
6-
},
7-
})
82
</script>
93

104
<template>
115
<main
12-
class="absolute left-0 h-full w-full overflow-y-auto pt-54"
13-
:style="`padding-left: ${paddingX}px; padding-right: ${paddingX}px`"
6+
class="absolute left-0 h-full w-full overflow-y-auto px-16 pt-54"
147
>
158
<slot />
169
</main>

src/pages/index.vue

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,45 +44,41 @@ async function languagePicker() {
4444
})
4545
}
4646
47-
const router = useRouter()
48-
const menuList = computed(() => ([
47+
const menus = computed(() => ([
4948
{ title: t('home.mockGuide'), router: 'mock' },
5049
{ title: t('home.echartsDemo'), router: 'charts' },
5150
{ title: t('home.persistPiniaState'), router: 'counter' },
52-
{ title: t('home.404Demo'), router: 'unknown' },
5351
{ title: t('home.unocssExample'), router: 'unocss' },
5452
{ title: t('home.keepAlive'), router: 'keepalive' },
53+
{ title: t('home.404Demo'), router: 'unknown' },
5554
]))
56-
57-
function menuClick(item: any) {
58-
if (item.router)
59-
router.push(item.router)
60-
}
6155
</script>
6256

6357
<template>
64-
<Container :padding-x="0">
65-
<var-paper :elevation="0" class="m-10 mt-20">
66-
<var-cell ripple :border="true" :border-offset="0">
58+
<Container>
59+
<var-paper radius="10">
60+
<var-cell border>
6761
{{ t('home.darkMode') }}
6862
<template #extra>
6963
<var-switch v-model="checked" @click="toggle" />
7064
</template>
7165
</var-cell>
7266

73-
<var-cell ripple :border="true" :border-offset="0" @click="languagePicker">
67+
<var-cell border @click="languagePicker">
7468
{{ t('home.language') }}
7569
<template #extra>
76-
<div class="w-150 flex items-center justify-right">
77-
{{ language }}
70+
<div class="w-80 flex items-center justify-right">
71+
<span>{{ language }}</span>
7872
<var-icon name="chevron-right" />
7973
</div>
8074
</template>
8175
</var-cell>
8276

8377
<var-cell
84-
v-for="(item, index) in menuList" :key="item.title" ripple :border="index !== menuList.length - 1"
85-
:border-offset="0" @click="menuClick(item)"
78+
v-for="(item, index) in menus"
79+
:key="item.router"
80+
:border="index !== menus.length - 1"
81+
@click="$router.push(item.router)"
8682
>
8783
{{ item.title }}
8884
<template #extra>

0 commit comments

Comments
 (0)