File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 3
3
import { createRoute , isSameRoute , isIncludedRoute } from '../util/route'
4
4
import { extend } from '../util/misc'
5
5
import { normalizeLocation } from '../util/location'
6
+ import { warn } from '../util/warn'
6
7
7
8
// work around weird flow bug
8
9
const toTypes : Array < Function > = [String, Object]
@@ -97,8 +98,19 @@ export default {
97
98
} )
98
99
99
100
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
+ }
102
114
}
103
115
104
116
if ( this . tag === 'a ') {
You can’t perform that action at this time.
0 commit comments