我如何测试一个带有槽的组件,例如,carousel里面有一个槽组件,滑块里面有一个槽组件。
This不支持该功能。
也许我必须使用e2e测试?
请告诉我怎么做。谢谢。
// This is how i use
<carousel>
<slide>
<div></div>
</slide>
</carousel>
// Carousel component
<carousel>
<slot></slot>
</carousel>
// Slide component
<slide>
<slot></slot>
</slide>
发布于 2018-09-04 17:56:34
你必须像this一样编辑vue的原型
在main.js文件中
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);您只需要将v-bind="{$scopedSlots}"添加到组件中。
https://stackoverflow.com/questions/52155711
复制相似问题