8000 vue-router/examples/route-matching/app.js at dev · vuejs/vue-router · GitHub
[go: up one dir, main page]

Skip to content
< 5464 script type="application/json" data-target="react-app.embeddedData">{"payload":{"allShortcutsEnabled":false,"fileTree":{"examples/route-matching":{"items":[{"name":"app.js","path":"examples/route-matching/app.js","contentType":"file"},{"name":"index.html","path":"examples/route-matching/index.html","contentType":"file"}],"totalCount":2},"examples":{"items":[{"name":"active-links","path":"examples/active-links","contentType":"directory"},{"name":"auth-flow","path":"examples/auth-flow","contentType":"directory"},{"name":"basic","path":"examples/basic","contentType":"directory"},{"name":"composables","path":"examples/composables","contentType":"directory"},{"name":"data-fetching","path":"examples/data-fetching","contentType":"directory"},{"name":"discrete-components","path":"examples/discrete-components","contentType":"directory"},{"name":"hash-mode","path":"examples/hash-mode","contentType":"directory"},{"name":"hash-scroll-behavior","path":"examples/hash-scroll-behavior","contentType":"directory"},{"name":"keepalive-view","path":"examples/keepalive-view","contentType":"directory"},{"name":"lazy-loading-before-mount","path":"examples/lazy-loading-before-mount","contentType":"directory"},{"name":"lazy-loading","path":"examples/lazy-loading","contentType":"directory"},{"name":"multi-app","path":"examples/multi-app","contentType":"directory"},{"name":"named-routes","path":"examples/named-routes","contentType":"directory"},{"name":"named-views","path":"examples/named-views","contentType":"directory"},{"name":"navigation-guards","path":"examples/navigation-guards","contentType":"directory"},{"name":"nested-router","path":"examples/nested-router","contentType":"directory"},{"name":"nested-routes","path":"examples/nested-routes","contentType":"directory"},{"name":"redirect","path":"examples/redirect","contentType":"directory"},{"name":"restart-app","path":"examples/restart-app","contentType":"directory"},{"name":"route-alias","path":"examples/route-alias","contentType":"directory"},{"name":"route-matching","path":"examples/route-matching","contentType":"directory"},{"name":"route-params","path":"examples/route-params","contentType":"directory"},{"name":"route-props","path":"examples/route-props","contentType":"directory"},{"name":"router-errors","path":"examples/router-errors","contentType":"directory"},{"name":"scroll-behavior","path":"examples/scroll-behavior","contentType":"directory"},{"name":"transitions","path":"examples/transitions","contentType":"directory"},{"name":"global.css","path":"examples/global.css","contentType":"file"},{"name":"index.html","path":"examples/index.html","contentType":"file"},{"name":"server.js","path":"examples/server.js","contentType":"file"},{"name":"webpack.config.js","path":"examples/webpack.config.js","contentType":"file"}],"totalCount":30},"":{"items":[{"name":".circleci","path":".circleci","contentType":"directory"},{"name":".github","path":".github","contentType":"directory"},{"name":"assets","path":"assets","contentType":"directory"},{"name":"build","path":"build","contentType":"directory"},{"name":"dist","path":"dist","contentType":"directory"},{"name":"docs-gitbook","path":"docs-gitbook","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"flow","path":"flow","contentType":"directory"},{"name":"scripts","path":"scripts","contentType":"directory"},{"name":"src","path":"src","contentType":"directory"},{"name":"test","path":"test","contentType":"directory"},{"name":"types","path":"types","contentType":"directory"},{"name":"vetur","path":"vetur","contentType":"directory"},{"name":".babelrc","path":".babelrc","contentType":"file"},{"name":".eslintignore","path":".eslintignore","contentType":"file"},{"name":".eslintrc","path":".eslintrc","contentType":"file"},{"name":".flowconfig","path":".flowconfig","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".prettierrc","path":".prettierrc","contentType":"file"},{"name":"CHANGELOG.md","path":"CHANGELOG.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"composables.d.ts","path":"composables.d.ts","contentType":"file"},{"name":"composables.js","path":"composables.js","contentType":"file"},{"name":"composables.mjs","path":"composables.mjs","contentType":"file"},{"name":"netlify.toml","path":"netlify.toml","contentType":"file"},{"name":"package.json","path":"package.json","contentType":"file"},{"name":"yarn.lock","path":"yarn.lock","contentType":"file"}],"totalCount":29}},"fileTreeProcessingTime":18.767285,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":15116946,"defaultBranch":"dev","name":"vue-router","ownerLogin":"vuejs","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2013-12-11T19:37:46.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/6128107?v=4","public":true,"private":false,"isOrgOwned":true},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"dev","listCacheKey":"v0:1750740794.0","canEdit":false,"refType":"branch","currentOid":"786ed347ef0e72adc8a3ebe86d5105dd8748c0a6"},"path":"examples/route-matching/app.js","currentUser":null,"blob":{"rawLines":["import Vue from 'vue'","import VueRouter from 'vue-router'","","Vue.use(VueRouter)","","// The matching uses path-to-regexp, which is the matching engine used","// by express as well, so the same matching rules apply.","// For detailed rules, see https://github.com/pillarjs/path-to-regexp","const router = new VueRouter({"," mode: 'history',"," base: __dirname,"," routes: ["," { path: '/' },"," // params are denoted with a colon \":\""," { path: '/params/:foo/:bar' },"," // a param can be made optional by adding \"?\""," { path: '/optional-params/:foo?' },"," // a param can be followed by a regex pattern in parens"," // this route will only be matched if :id is all numbers"," { path: '/params-with-regex/:id(\\\\d+)' },"," // asterisk can match anything"," { path: '/asterisk/*' },"," // make part of the path optional by wrapping with parens and add \"?\""," { path: '/optional-group/(foo/)?bar' }"," ]","})","","new Vue({"," router,"," template: `"," \u003cdiv id=\"app\"\u003e"," \u003ch1\u003eRoute Matching\u003c/h1\u003e"," \u003cul\u003e"," \u003cli\u003e\u003crouter-link to=\"/\"\u003e/\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/params/foo/bar\"\u003e/params/foo/bar\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/optional-params\"\u003e/optional-params\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/optional-params/foo\"\u003e/optional-params/foo\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/params-with-regex/123\"\u003e/params-with-regex/123\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/params-with-regex/abc\"\u003e/params-with-regex/abc\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/asterisk/foo\"\u003e/asterisk/foo\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/asterisk/foo/bar\"\u003e/asterisk/foo/bar\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/optional-group/bar\"\u003e/optional-group/bar\u003c/router-link\u003e\u003c/li\u003e"," \u003cli\u003e\u003crouter-link to=\"/optional-group/foo/bar\"\u003e/optional-group/foo/bar\u003c/router-link\u003e\u003c/li\u003e"," \u003c/ul\u003e"," \u003cp\u003eRoute context\u003c/p\u003e"," \u003cpre\u003e{{ JSON.stringify($route, null, 2) }}\u003c/pre\u003e"," \u003c/div\u003e"," `","}).$mount('#app')"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/vuejs/vue-router/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"app.js","displayUrl":"https://github.com/vuejs/vue-router/blob/dev/examples/route-matching/app.js?raw=true","headerInfo":{"blobSize":"1.92 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"2d0b6b6","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fvuejs%2Fvue-router%2Fblob%2Fdev%2Fexamples%2Froute-matching%2Fapp.js","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"49","truncatedSloc":"46"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"JavaScript","languageID":183,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/vuejs/vue-router/blob/dev/examples/route-matching/app.js","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/vuejs/vue-router/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/vuejs/vue-router/raw/refs/heads/dev/examples/route-matching/app.js","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/vuejs/vue-router/branches":{"post":"iz5LCqnZffE9SJProhBnmpDAk4uOnkEZ_EqgZeyYO0eYuRxTZGHI4Y5dX-YDB0JbROTi5nXj5DVmt7k7BS9exQ"},"/repos/preferences":{"post":"oYcFxYM1ZKAtOEC0YEMKxR-agf21R_yTfmBreQQbERURVv5nJbsclD1qVc8I76GtB4DivNJcLCm1RdPRK9Fy0w"}}},"title":"vue-router/examples/route-matching/app.js at dev · vuejs/vue-router","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-b84e9496fc59.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0