问题描述
我需要使用 vue js slot 将内容注入到 dom 中的任何位置。
该组件将具有如下道具 -
1. in: The target element. Should be able to accept a string selector,or an element as object.
2. as: Defines one of the insert modes: (append,prepend,replace,fill)
我仍在寻找如何在给定的选择器中呈现插槽并根据给定的插入模式插入的解决方案。下面是我的插槽组件 -
MySlotComponent.vue:
<script>
export default {
props: {
in: {
type: [String,Object],default: 'body'
},as: {
type: String,default: 'append'
}
},render(h) {
return this.$scopedSlots.default();
},}
</script>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)