Commit 66c7b3cf authored by 杨奕's avatar 杨奕 Committed by GitHub

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

parent 0b2a1eb7
...@@ -29,15 +29,13 @@ ...@@ -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;
let to = this.to;
link.setAttribute('role', 'link'); link.setAttribute('role', 'link');
link.addEventListener('click', _ => { link.addEventListener('click', _ => {
this.replace ? this.$router.replace(to) const { to, $router } = this;
: this.$router.push(to); if (!to || !$router) return;
this.replace ? $router.replace(to) : $router.push(to);
}); });
} }
}
}; };
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment