File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 33import { createRoute , isSameRoute , isIncludedRoute } from '../util/route'
44import { extend } from '../util/misc'
55import { normalizeLocation } from '../util/location'
6+ import { warn } from '../util/warn'
67
78// work around weird flow bug
89const toTypes : Array < Function > = [String, Object]
@@ -97,8 +98,19 @@ export default {
9798 } )
9899
99100 if (scopedSlot) {
100- if ( scopedSlot . length > 1 || ! scopedSlot . length ) throw new Error ( 'no' )
101- return scopedSlot [ 0 ]
101+ if ( scopedSlot . length === 1 ) {
102+ return scopedSlot [ 0 ]
103+ } else if (scopedSlot.length > 1 || ! scopedSlot . length ) {
104+ if ( process . env . NODE_ENV !== 'production' ) {
105+ warn (
106+ false ,
107+ `RouterLink with to="${
108+ this . props . to
109+ } " is trying to use a scoped slot but it didn't provide exactly one child.`
110+ )
111+ }
112+ return scopedSlot.length === 0 ? h() : h('span', { } , scopedSlot)
113+ }
102114 }
103115
104116 if ( this . tag === 'a ') {
You can’t perform that action at this time.
0 commit comments