Created
January 23, 2019 13:55
-
-
Save PinkiNice/905d3ac9f1dc4c0e8cf5c73276669a50 to your computer and use it in GitHub Desktop.
Pass slots to child component Vue.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/vuejs/vue/pull/7765#issuecomment-401985464 | |
Vue.prototype._b = (function(bind) { | |
return function(data, tag, value, asProp, isSync) { | |
if (value && value.$scopedSlots) { | |
data.scopedSlots = value.$scopedSlots; | |
delete value.$scopedSlots; | |
} | |
return bind.apply(this, arguments); | |
}; | |
})(Vue.prototype._b); | |
/* | |
After that use as: | |
<child v-bind="{$scopedSlots}"> | |
</child> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment