From cfca5c51da2b0df0bead28786366a2516ee20007 Mon Sep 17 00:00:00 2001 From: VdustR Date: Tue, 20 Feb 2018 23:18:47 +0800 Subject: [PATCH] fix(MdBottomBarItem): missing props to for router link 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 () {