File tree Expand file tree Collapse file tree 15 files changed +99
-136
lines changed Expand file tree Collapse file tree 15 files changed +99
-136
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ onMounted(() => {
3333
3434<template >
3535 <VanConfigProvider :theme =" mode" >
36+ <NavBar />
3637 <router-view v-slot =" { Component, route }" >
3738 <transition :name =" routeTransitionName" >
3839 <div :key =" route.name" class =" app-wrapper" >
@@ -45,11 +46,11 @@ onMounted(() => {
4546
4647<style scoped>
4748.app-wrapper {
48- position : absolute ;
49- top : 0 ;
50- left : 0 ;
5149 width : 100% ;
5250 height : 100% ;
51+ position : absolute ;
52+ top : 46px ;
53+ left : 0 ;
5354 overflow-y : auto ;
5455}
5556 </style >
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export {}
88declare module 'vue' {
99 export interface GlobalComponents {
1010 Chart : typeof import ( './components/chart/index.vue' ) [ 'default' ]
11- Container : typeof import ( './components/container/index .vue' ) [ 'default' ]
11+ NavBar : typeof import ( './components/NavBar .vue' ) [ 'default' ]
1212 RouterLink : typeof import ( 'vue-router' ) [ 'RouterLink' ]
1313 RouterView : typeof import ( 'vue-router' ) [ 'RouterView' ]
1414 VanButton : typeof import ( 'vant/es' ) [ 'Button' ]
Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ const route = useRoute ()
3+ const router = useRouter ()
4+
5+ function onBack() {
6+ if (history .length > 1 )
7+ history .back ()
8+ else
9+ router .replace (' /' )
10+ }
11+
12+ const title = computed (() => {
13+ const { title } = (route .meta as { title? : string }) || {}
14+ return title || ' '
15+ })
16+ </script >
17+
18+ <template >
19+ <VanNavBar
20+ v-show =" title"
21+ :title =" title"
22+ :fixed =" true"
23+ left-arrow clickable
24+ @click-left =" onBack"
25+ />
26+ </template >
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -15,7 +15,3 @@ const router = useRouter()
1515 </div >
1616 </main >
1717</template >
18-
19- <style scoped>
20-
21- </style >
Original file line number Diff line number Diff line change 11<template >
2- <main text =" gray-700 dark:gray-200" >
2+ <main p = " 16 " text =" gray-700 dark:gray-200" >
33 <RouterView />
44
5- <div mx-auto mt -15 text-center text-14 opacity-50 >
5+ <div mx-auto py -15 text-center text-14 opacity-50 >
66 Default Layout
77 </div >
88 </main >
Original file line number Diff line number Diff line change 11<template >
2- <main py-20 text =" gray-700 dark:gray-200" >
2+ <main text =" gray-700 dark:gray-200" >
33 <RouterView />
44
55 <div mx-auto mt-15 text-center text-14 opacity-50 >
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ definePage({
33 name: ' charts' ,
44 meta: {
55 level: 2 ,
6+ title: ' 📊 Echarts 演示' ,
67 },
78})
89
@@ -62,38 +63,12 @@ const scoreOption = {
6263const refBarOption = ref (barOption )
6364const refLineOption = ref (lineOption )
6465const refScoreOption = ref (scoreOption )
65-
66- // back
67- const onClickLeft = () => history .back ()
6866 </script >
6967
7068<template >
7169 <div >
72- <VanNavBar title =" 📊 Echarts" left-arrow fixed @click-left =" onClickLeft" />
73-
74- <Container >
75- <div class =" chart" >
76- <Chart :option =" refBarOption" :style =" { height: '330px' }" />
77- </div >
78-
79- <div class =" chart item" >
80- <Chart :option =" refLineOption" :style =" { height: '330px' }" />
81- </div >
82-
83- <div class =" chart item" >
84- <Chart :option =" refScoreOption" :style =" { height: '330px' }" />
85- </div >
86- </Container >
70+ <Chart :option =" refBarOption" :style =" { height: '330px' }" />
71+ <Chart :option =" refLineOption" :style =" { height: '330px' }" />
72+ <Chart :option =" refScoreOption" :style =" { height: '330px' }" />
8773 </div >
8874</template >
89-
90- <style lang="less" scoped>
91- .chart {
92- width : 100% ;
93- height : 300px ;
94- }
95-
96- .chart.item {
97- margin-top : 15px ;
98- }
99- </style >
You can’t perform that action at this time.
0 commit comments