Skip to content

Commit

Permalink
ref(vue): Add vue-router version support information (#5662)
Browse files Browse the repository at this point in the history
This adds a note on which vue-router versions are supported by our vue routing instrumentation. Also did some minor cleanup of the code example as it contained some unnecessary lines.

Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
  • Loading branch information
Lms24 and imatwawana committed Oct 18, 2022
1 parent cd7c382 commit 8c2c2c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ redirect_from:
- /sdks/react/integrations/vue-router/
---

If you are using Vue Router, you should use our provided integration to get better, parameterized transaction names. Here is a full example of how to use it:
If you're using Vue Router, you should use our provided routing instrumentation to get better, parameterized transaction names.

```javascript
Our routing instrumentation supports `vue-router` v2, v3, and v4.

Here is a full example of how to use it:

```javascript {filename:main.js}
import Vue from "vue";
import App from "./App";
import * as Sentry from "@sentry/vue";
import { BrowserTracing } from "@sentry/tracing";
import Router from "vue-router";
import HelloWorld from "@/components/HelloWorld";
import Foo from "@/components/Foo";
import Bar from "@/components/Bar";

Vue.use(Router);

const Foo = { template: "<div>foo</div>" };
const Bar = { template: "<div>bar</div>" };

const router = new Router({
routes: [
{
Expand All @@ -32,21 +35,17 @@ const router = new Router({
],
});

Vue.config.productionTip = false;

Sentry.init({
Vue: Vue,
Vue,
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 1.0,
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
}),
],
trackComponents: true,
});

/* eslint-disable no-new */
new Vue({
el: "#app",
router,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Sentry.init({
tracingOptions: {
trackComponents: true;
timeout: 500;
hooks: string['mount', 'update'];
hooks: ['mount', 'update'];
}
})
```
Expand Down

1 comment on commit 8c2c2c7

@vercel
Copy link

@vercel vercel bot commented on 8c2c2c7 Oct 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

sentry-docs-git-master.sentry.dev
docs.sentry.io
sentry-docs.sentry.dev

Please sign in to comment.