File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ new Vue({
43
43
<li><router-link to="/é">/é</router-link></li>
44
44
<li><router-link to="/é?t=%25ñ">/é?t=%ñ</router-link></li>
45
45
<li><router-link to="/é#%25ñ">/é#%25ñ</router-link></li>
46
+ <router-link to="/foo" v-slot="props">
47
+ <li :class="[props.isActive && 'active', props.isExactActive && 'exact-active']">
48
+ <a :href="props.href" @click="props.navigate">{{ props.route.path }} (with v-slot).</a>
49
+ </li>
50
+ </router-link>
46
51
</ul>
47
52
<button id="navigate-btn" @click="navigateAndIncrement">On Success</button>
48
53
<pre id="counter">{{ n }}</pre>
Original file line number Diff line number Diff line change @@ -83,8 +83,28 @@ export default {
83
83
on [ this . event ] = handler
84
84
}
85
85
86
- const data: any = {
87
- class : classes
86
+ const data: any = { class : classes }
87
+
88
+ console.log({
89
+ scoped : this . $scopedSlots ,
90
+ slots : this . $slots
91
+ } )
92
+ const scopedSlot =
93
+ !this.$scopedSlots.$hasNormal &&
94
+ this . $scopedSlots . default &&
95
+ this . $scopedSlots . default ( {
96
+ href ,
97
+ route ,
98
+ navigate : handler ,
99
+ isActive : classes [ activeClass ] ,
100
+ isExactActive : classes [ exactActiveClass ]
101
+ } )
102
+
103
+ console.log(scopedSlot)
104
+
105
+ if (scopedSlot) {
106
+ if ( scopedSlot . length > 1 || ! scopedSlot . length ) throw new Error ( 'no' )
107
+ return scopedSlot [ 0 ]
88
108
}
89
109
90
110
if (this.tag === 'a') {
You can’t perform that action at this time.
0 commit comments