]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: add functional component to playground
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 6 Oct 2020 13:04:08 +0000 (15:04 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 6 Oct 2020 13:04:08 +0000 (15:04 +0200)
e2e/encoding/index.ts

index ac9dafe84852c7bb30aa3deac912d59f7e0f3699..bc28f62684d359b0adf5907cf3d0ea09b6d00978 100644 (file)
@@ -1,6 +1,6 @@
 import { createRouter, createWebHistory } from '../../src'
 import { RouteComponent } from '../../src/types'
-import { createApp, defineComponent } from 'vue'
+import { createApp, defineComponent, FunctionalComponent, h } from 'vue'
 
 const component: RouteComponent = {
   template: `<div>A component</div>`,
@@ -14,6 +14,9 @@ const ParamId = defineComponent({
   template: `<div>id: <span id="p-id">"{{ $route.params.id }}"</span></div>`,
 })
 
+const FunctionalView: FunctionalComponent = () =>
+  h('div', 'functional component')
+
 // full URL / !"$&'()*+,:;<=>%3F@[]^`{|}?a= !"$&'()*+,/:;<=>?@[]^`{|}# !"#$&'()*+,:;<=>?@[]^`{|}
 
 const router = createRouter({
@@ -21,6 +24,7 @@ const router = createRouter({
   history: createWebHistory('/' + __dirname),
   routes: [
     { path: '/', component: Home, name: 'home' },
+    { path: '/functional', component: FunctionalView },
     { path: '/:id', component: ParamId, name: 'param' },
     { path: '/documents/:id', name: 'docs', component: ParamId },
     { path: encodeURI('/n/€'), name: 'euro', component },