Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add router tab #735

Merged
merged 33 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0343b9e
First draft of implementation
markussorg Mar 1, 2017
55ebe90
Work on route filtering
markussorg Mar 2, 2017
2c66bca
Add route list column
markussorg Mar 3, 2017
60e47bd
Fix pane dragging
markussorg Mar 3, 2017
5de0eba
Extract diff into own method
markussorg Mar 3, 2017
1849889
Extract panes styling
markussorg Mar 3, 2017
6148b9e
Add nicer styling for redirect flag
markussorg Mar 3, 2017
6307110
Extract styling to common.styl
markussorg Mar 3, 2017
55eaeca
Fix highlight color of entries
markussorg Mar 3, 2017
f4b68a8
Remove duplicate styling of entry elements
markussorg Mar 3, 2017
5e1ad71
Make route list heading h3
markussorg Mar 3, 2017
1ea5a0f
Change route list heading
markussorg Mar 3, 2017
3aad9e0
Remove console.log
markussorg Mar 3, 2017
d9a5702
Fix closing tag in IndexRoute.vue
markussorg Mar 3, 2017
33e31b7
Merge branch 'master' into add-routing-tab
yyx990803 Mar 14, 2017
cb7adda
Merge pull request #2 from vuejs/master
armano2 May 6, 2017
592a53f
Implement toggle recording in router view list & simplyfy list of rou…
May 6, 2017
2a06db6
Add support for nested routes in router config
May 6, 2017
867439d
Split router from routes
May 6, 2017
d8b2dc5
Add fully working routes tab
armano2 May 7, 2017
98af5c9
Fix posible issue when there is no routes when routing is initialized.
armano2 May 7, 2017
8971b85
Fix issue with not beeing allowed to select nested routes
armano2 May 7, 2017
c64b462
Merge branch 'master' into add-routing-tab
armano2 May 23, 2017
5955259
Merge branch 'dev' into add-router-tab
shentao Aug 5, 2018
3871f23
Merge branch 'dev' into add-router-tab
Aug 8, 2018
86b4d3f
feat: routing tab keyboard shortcut
Aug 8, 2018
fb3ba54
feat: integrate routes history into framerate graph
Aug 8, 2018
ce25790
fix: error if no corresponding metric
Aug 8, 2018
6014338
Merge branch 'dev' into add-router-tab
Aug 9, 2018
f5869c9
chore: add keep-alive in example
Aug 31, 2018
6ae3488
Merge branch 'dev' into add-router-tab
Aug 31, 2018
604b9af
fix: abstract component error
Aug 31, 2018
bae5971
fix(GroupDropdown): style + dark mode
Aug 31, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion shells/dev/target/NativeTypes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@

<p>
<button @click="sendComponent()">Vuex mutation</button>
<button @click="createLargeArray()">Create large array</button>
<button
style="background: red; color: white;"
@click="createLargeArray()"
>
Create large array
</button>
</p>

<h3>Set</h3>
Expand Down
23 changes: 0 additions & 23 deletions shells/dev/target/Router.vue

This file was deleted.

14 changes: 7 additions & 7 deletions shells/dev/target/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import VuexObject from './VuexObject.vue'
import NativeTypes from './NativeTypes.vue'
import Events from './Events.vue'
import MyClass from './MyClass.js'
import Router from './Router.vue'
import router from './router'
import Router from './router/Router.vue'

window.VUE_DEVTOOLS_CONFIG = {
openInEditorHost: '/'
Expand All @@ -25,6 +25,12 @@ circular.self = circular
new Vue({
store,
router,
data: {
obj: {
items: items,
circular
}
},
render (h) {
return h('div', null, [
h(Counter),
Expand All @@ -35,12 +41,6 @@ new Vue({
h(Router, { key: [] }),
h(VuexObject)
])
},
data: {
obj: {
items: items,
circular
}
}
}).$mount('#app')

Expand Down
44 changes: 40 additions & 4 deletions shells/dev/target/router.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Page1 from './Page1.vue'
import Page2 from './Page2.vue'
import RouteOne from './router/RouteOne.vue'
import RouteTwo from './router/RouteTwo.vue'
import RouteWithParams from './router/RouteWithParams.vue'
import NamedRoute from './router/NamedRoute.vue'
import RouteWithQuery from './router/RouteWithQuery.vue'
import RouteWithBeforeEnter from './router/RouteWithBeforeEnter.vue'
import RouteWithAlias from './router/RouteWithAlias.vue'
import RouteWithProps from './router/RouteWithProps.vue'
import ParentRoute from './router/ParentRoute.vue'
import ChildRoute from './router/ChildRoute.vue'

Vue.use(VueRouter)

const DynamicComponent = {
render: (h) => h('div', 'Hello from dynamic component')
}

const routes = [
{ path: '/', name: 'page1', component: Page1 },
{ path: '/page2', name: 'page2', component: Page2 }
{ path: '/route-one', component: RouteOne },
{ path: '/route-two', component: RouteTwo },
{ path: '/route-with-params/:username/:id', component: RouteWithParams },
{ path: '/route-named', component: NamedRoute, name: 'NamedRoute' },
{ path: '/route-with-query', component: RouteWithQuery },
{ path: '/route-with-before-enter',
component: RouteWithBeforeEnter,
beforeEnter: (to, from, next) => {
next()
}},
{ path: '/route-with-redirect', redirect: '/route-one' },
{ path: '/route-with-alias', component: RouteWithAlias, alias: '/this-is-the-alias' },
{ path: '/route-with-dynamic-component', component: DynamicComponent, props: true },
{ path: '/route-with-props',
component: RouteWithProps,
props: {
username: 'My Username',
id: 99
}},
{ path: '/route-with-props-default', component: RouteWithProps },
{ path: '/route-parent',
component: ParentRoute,
children: [
{ path: '/route-child', component: ChildRoute }
]
}
]

const router = new VueRouter({
Expand Down
9 changes: 9 additions & 0 deletions shells/dev/target/router/ChildRoute.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<h2>Child route</h2>
</template>

<script>
export default {

}
</script>
10 changes: 10 additions & 0 deletions shells/dev/target/router/NamedRoute.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div>
<p>Hello named route</p>
</div>
</template>

<script>
export default {
}
</script>
12 changes: 12 additions & 0 deletions shells/dev/target/router/ParentRoute.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<div class="parent">
<h2>Parent</h2>
<router-view class="child"></router-view>
</div>
</template>

<script>
export default {

}
</script>
11 changes: 11 additions & 0 deletions shells/dev/target/router/RouteOne.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div>
<p>Hello from route 1</p>
</div>
</template>

<script>
export default {

}
</script>
11 changes: 11 additions & 0 deletions shells/dev/target/router/RouteTwo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div>
<p>Hello from route 2</p>
</div>
</template>

<script>
export default {

}
</script>
10 changes: 10 additions & 0 deletions shells/dev/target/router/RouteWithAlias.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div>
<p>Hello from route with alias</p>
</div>
</template>

<script>
export default {
}
</script>
10 changes: 10 additions & 0 deletions shells/dev/target/router/RouteWithBeforeEnter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div>
<p>Hello from before enter route</p>
</div>
</template>

<script>
export default {
}
</script>
11 changes: 11 additions & 0 deletions shells/dev/target/router/RouteWithParams.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div>
<p>Hello from route with params: Username: {{ $route.params.username }}, Id: {{ $route.params.id }}</p>
</div>
</template>

<script>
export default {

}
</script>
20 changes: 20 additions & 0 deletions shells/dev/target/router/RouteWithProps.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<template>
<div>
<p>Hello from route with props: Username: {{ username }}, Id: {{ id }}</p>
</div>
</template>

<script>
export default {
props: {
username: {
type: String,
default: 'ms'
},
id: {
type: Number,
default: 33
}
}
}
</script>
10 changes: 10 additions & 0 deletions shells/dev/target/router/RouteWithQuery.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div>
<p>Hello from route with query: {{ $route.query }}</p>
</div>
</template>

<script>
export default {
}
</script>
35 changes: 35 additions & 0 deletions shells/dev/target/router/Router.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<div>
<p><router-link to="/route-one">Go to Route One</router-link></p>
<p><router-link to="/route-two">Go to Route Two</router-link></p>
<p><router-link to="/route-with-params/markussorg/5">Go to route with params</router-link></p>
<p><router-link to="/route-named">Go to named route</router-link></p>
<p><router-link to="/route-with-query?el=value&test=true">Go to route with query</router-link></p>
<p><router-link to="/route-with-before-enter">Go to route with before enter</router-link></p>
<p><router-link to="/route-with-redirect">Go to route with redirect</router-link></p>
<p><router-link to="/this-is-the-alias">Go to route with alias</router-link></p>
<p><router-link to="/route-with-dynamic-component">Go to route with dyn. component</router-link></p>
<p><router-link to="/route-with-props">Go to route with props</router-link></p>
<p><router-link to="/route-with-props-default">Go to route with props (default)</router-link></p>
<p><router-link to="/route-parent">Go to route parent</router-link></p>
<p><router-link to="/route-child">Go to route child</router-link></p>
<keep-alive>
<router-view />
</keep-alive>
<p><button @click="addRoutes">Add new routes</button></p>
</div>
</template>

<script>
import RouteOne from './RouteOne.vue'

export default {
methods: {
addRoutes () {
this.$router.addRoutes([
{ path: '/new-route', component: RouteOne }
])
}
}
}
</script>
8 changes: 7 additions & 1 deletion src/backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { highlight, unHighlight, getInstanceOrVnodeRect } from './highlighter'
import { initVuexBackend } from './vuex'
import { initEventsBackend } from './events'
import { initRouterBackend } from './router'
import { initPerfBackend } from './perf'
import { findRelatedComponent } from './utils'
import { stringify, classify, camelize, set, parse, getComponentName } from '../util'
Expand Down Expand Up @@ -121,6 +122,10 @@ function connect (Vue) {
})
}

hook.once('router:init', () => {
initRouterBackend(hook.Vue, bridge, rootInstances)
})

// events
initEventsBackend(Vue, bridge)

Expand Down Expand Up @@ -206,6 +211,7 @@ function scan () {
return true
}
})
hook.emit('router:init')
flush()
}

Expand Down Expand Up @@ -340,7 +346,7 @@ function capture (instance, index, list) {
captureCount++
}

if (instance.$options && instance.$options.abstract) {
if (instance.$options && instance.$options.abstract && instance._vnode.componentInstance) {
instance = instance._vnode.componentInstance
}

Expand Down
6 changes: 4 additions & 2 deletions src/backend/perf.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ function applyHooks (vm) {
if (renderHook && renderHook.before) {
// Render hook ends before one hook
const metric = renderMetrics[renderHook.before]
metric.end = time
addComponentMetric(vm.$options, renderHook.before, metric.start, metric.end)
if (metric) {
metric.end = time
addComponentMetric(vm.$options, renderHook.before, metric.start, metric.end)
}
}

// After
Expand Down
Loading