Skip to content

Commit c5c4444

Browse files
committed
add page search input
1 parent c990f5c commit c5c4444

2 files changed

Lines changed: 58 additions & 3 deletions

File tree

web/src/App.vue

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@
7070
<!--</v-btn>-->
7171
<v-toolbar-title v-text="title"></v-toolbar-title>
7272
<v-spacer></v-spacer>
73+
<v-select
74+
flat
75+
solo-inverted
76+
autocomplete
77+
prepend-icon="search"
78+
label="Page Search"
79+
class="hidden-sm-and-down"
80+
item-text="name"
81+
:items="pages"
82+
v-model="userInput"
83+
@change="gotoPage"
84+
></v-select>
7385
<v-btn icon @click.stop="clipped = !clipped">
7486
<v-icon>web</v-icon>
7587
</v-btn>
@@ -120,27 +132,50 @@
120132

121133
<script>
122134
import sidebar from './libs/sidebar'
135+
import routes from './router/routes'
136+
import {VSelect} from 'vuetify'
123137
import {URI_PREFIX} from './libs/constants'
124138
import NProgress from './views/parts/NProgress'
125139
import AppFooter from './views/parts/AppFooter'
126140
import * as VBreadcrumbs from 'vuetify/es5/components/VBreadcrumbs'
127141
128142
export default {
129-
components: {AppFooter, NProgress, ...VBreadcrumbs},
143+
name: 'App',
144+
components: {AppFooter, NProgress, VSelect, ...VBreadcrumbs},
130145
data() {
146+
let pages = []
147+
148+
for (let key in routes) {
149+
let route = routes[key]
150+
if (!route.name) {
151+
continue
152+
}
153+
154+
pages.push({
155+
path: route.path,
156+
name: route.name
157+
})
158+
}
159+
131160
return {
132161
clipped: false,
133162
drawer: true,
134163
fixed: false,
135164
uriPrefix: URI_PREFIX,
136165
items: sidebar,
166+
pages: pages,
137167
miniVariant: false,
138168
right: true,
139169
rightDrawer: false,
140-
title: 'DevTool'
170+
title: 'DevTool',
171+
userInput: null
141172
}
142173
},
143-
name: 'App'
174+
methods: {
175+
gotoPage (item) {
176+
this.$router.push(item.path)
177+
}
178+
}
144179
}
145180
</script>
146181

web/src/views/parts/PageSearch.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
<div>
3+
<v-select
4+
:items="states"
5+
v-model="a1"
6+
label="Search"
7+
autocomplete
8+
></v-select>
9+
</div>
10+
</template>
11+
12+
<script>
13+
export default {
14+
name: 'page-search'
15+
}
16+
</script>
17+
18+
<style scoped>
19+
20+
</style>

0 commit comments

Comments
 (0)