0👍
First you should define your functions inside the methods
property. Also component scoped variables inside the data
function.
Like this:
export default class Breadcrumb extends Vue {
data() {
return {
breadcrumbList: []
}
},
mounted(): void {
...
},
methods: {
goTo(breadcrumb: BreadcrumbData) {
if (breadcrumb.link) {
this.$router.push(breadcrumb.link as RawLocation);
}
}
}
}
https://v2.vuejs.org/v2/guide/instance.html#Data-and-Methods
Then you can reach them from tests too.
Source:stackexchange.com