From: Eduardo San Martin Morote Date: Thu, 7 Feb 2019 19:38:11 +0000 (+0100) Subject: add explorations X-Git-Tag: v4.0.0-alpha.0~479 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71df390ea740de1b0e24e9bf7a4382bb8e371136;p=thirdparty%2Fvuejs%2Frouter.git add explorations --- diff --git a/explorations/html5.html b/explorations/html5.html new file mode 100644 index 00000000..e3e0b259 --- /dev/null +++ b/explorations/html5.html @@ -0,0 +1,11 @@ + + + + + + + Testing History HTML5 + + + + diff --git a/explorations/html5.ts b/explorations/html5.ts new file mode 100644 index 00000000..6ed60906 --- /dev/null +++ b/explorations/html5.ts @@ -0,0 +1,35 @@ +import HTML5History from '../src/history/html5' +import { Router } from '../src' + +const component = null + +const r = new Router({ + history: new HTML5History(), + routes: [ + { path: '/', component }, + { path: '/users/:id', name: 'user', component }, + { path: /^\/about\/?$/, component }, + ], +}) + +const h = new HTML5History() +// @ts-ignore +window.h = h +// @ts-ignore +window.r = r + +h.listen((to, from) => { + console.log({ to, from }) +}) + +r.push('/about') +r.push({ + path: '/', +}) + +r.push({ + name: 'user', + params: { + id: '6', + }, +})