From 6860d3a004b09baef751724c0d9bf1ebdf92b752 Mon Sep 17 00:00:00 2001 From: Vi Pro Date: Wed, 21 Feb 2018 01:14:29 +0800 Subject: [PATCH] fix(MdBottomBarItem): missing props to for router link (#1531) fix #1412 --- .../MdBottomBar/MdBottomBarItem.vue | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/MdBottomBar/MdBottomBarItem.vue b/src/components/MdBottomBar/MdBottomBarItem.vue index 73c3ad17a..9aa34af1c 100644 --- a/src/components/MdBottomBar/MdBottomBarItem.vue +++ b/src/components/MdBottomBar/MdBottomBarItem.vue @@ -5,7 +5,7 @@ :id="id" :disabled="mdDisabled" :md-ripple="MdBottomBar.type === 'fixed'" - v-bind="$attrs" + v-bind="attrs" v-on="$listeners" @click="setActiveItem"> @@ -58,6 +58,18 @@ return { 'md-active': this.id === this.MdBottomBar.activeItem } + }, + attrs () { + let attrs = {...this.$attrs} + + const propNames = Object.keys(this.$options.propsData) + propNames.forEach(prop => { + if (!ignoredProps.includes(prop)) { + attrs[prop] = this[prop] + } + }) + + return attrs } }, methods: { @@ -99,14 +111,7 @@ beforeCreate () { if (this.$router && this.$options.propsData.to) { const componentProps = MdRouterLinkProps(this, this.$options.props) - const propNames = Object.keys(this.$options.propsData) - this.$options.props = componentProps - propNames.forEach(prop => { - if (!ignoredProps.includes(prop)) { - this.$attrs[prop] = this.$options.propsData[prop] - } - }) } }, created () {