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

ref(vue): Add vue-router version support information #5662

Merged
merged 2 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 are using Vue Router, you should use our provided routing instrumentation to get better, parameterized transaction names.
Lms24 marked this conversation as resolved.
Show resolved Hide resolved

```javascript
Our routing instrumentation supports `vue-router` v2, v3 and v4.
Lms24 marked this conversation as resolved.
Show resolved Hide resolved

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