mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-19 14:33:33 -04:00
Signed-off-by: lixingchi1 <lixingchi1@huawei.com>
This commit is contained in:
@@ -80,6 +80,7 @@ export interface AttrInterface {
|
||||
tid: number;
|
||||
append: string;
|
||||
slot: string;
|
||||
slotScope: string;
|
||||
name: string;
|
||||
data: () => any | string;
|
||||
$data: () => any | string;
|
||||
@@ -316,6 +317,15 @@ function compileSlot(vm: Vm, target: TemplateInterface, dest: Element): Element
|
||||
if (!namedContent) {
|
||||
compileChildren(vm, slotItem.target, slotItem.dest);
|
||||
} else {
|
||||
// Bind slot scope
|
||||
if (Array.isArray(namedContent)) {
|
||||
namedContent.forEach((item: TemplateInterface) => {
|
||||
const slotScope = item.attr && item.attr.slotScope;
|
||||
if (typeof slotScope === 'string') {
|
||||
parentVm[slotScope] = vm._data;
|
||||
}
|
||||
});
|
||||
}
|
||||
compileChildren(parentVm, { children: namedContent }, slotItem.dest);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user