Breadcrumb: fix regression of dynamic `to` support (#11286)

pull/11289/head
杨奕 2018-05-22 18:27:36 +08:00 committed by GitHub
parent 0b2a1eb784
commit 66c7b3cfc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -29,15 +29,13 @@
mounted() { mounted() {
this.separator = this.elBreadcrumb.separator; this.separator = this.elBreadcrumb.separator;
this.separatorClass = this.elBreadcrumb.separatorClass; this.separatorClass = this.elBreadcrumb.separatorClass;
if (this.to) { const link = this.$refs.link;
let link = this.$refs.link; link.setAttribute('role', 'link');
let to = this.to; link.addEventListener('click', _ => {
link.setAttribute('role', 'link'); const { to, $router } = this;
link.addEventListener('click', _ => { if (!to || !$router) return;
this.replace ? this.$router.replace(to) this.replace ? $router.replace(to) : $router.push(to);
: this.$router.push(to); });
});
}
} }
}; };
</script> </script>