提交 ab4470e8 编写于 作者: fxy060608's avatar fxy060608

fix(mp-toutiao): scoped slot

上级 13961ec4
......@@ -5022,6 +5022,13 @@ function renderSlot(name, props = {}) {
if (!vueIds) {
return;
}
if (!instance.parent && !instance.isMounted) {
// 头条小程序首次 render 时,还没有 parent
onMounted(() => {
renderSlot(name, props);
}, instance);
return;
}
const invoker = findScopedSlotInvoker(vueIds.split(',')[0], instance);
// 可能不存在,因为插槽不是必需的
if (invoker) {
......
import type { ComponentInternalInstance } from 'vue'
import type { ScopedSlotInvokers } from './withScopedSlot'
import { getCurrentInstance } from 'vue'
import { onMounted, getCurrentInstance } from 'vue'
export function renderSlot(name: string, props: Data = {}) {
const instance = getCurrentInstance() as ComponentInternalInstance
......@@ -8,6 +8,13 @@ export function renderSlot(name: string, props: Data = {}) {
if (!vueIds) {
return
}
if (!instance.parent && !instance.isMounted) {
// 头条小程序首次 render 时,还没有 parent
onMounted(() => {
renderSlot(name, props)
}, instance)
return
}
const invoker = findScopedSlotInvoker(vueIds.split(',')[0], instance)
// 可能不存在,因为插槽不是必需的
if (invoker) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册