1

我有一个接收以下上下文的父模板:

{
users: 
[
    {
        userId: "18288128",
        group: "User 1 Group Name",
        userVideos: [{ id: 1, name: "Video1"},
                     { id: 2, name: "Video2"},
                     { id: 3, name: "Video3"}]
    },
    {
        userId: "1232412",
        group: "User 2 Group Name",
        userVideos: [{ id: 4, name: "Video93"},
                     { id: 5, name: "Video384"},
                     { id: 6, name: "Video483"}]
    },
    {
        userId: "1231231",
        group: "User 3 Group Name",
        userVideos: [{ id: 7, name: "VideoA"},
                     { id: 8, name: "VideoB"},
                     { id: 9, name: "VideoC"}]
    }
]
}

这是父模板:

{#users}
  {! Here I want to add the partial video_list passing the correct parameters (uniqueId, groupName and the video list) !}
  {>video_list /}
{/users}

这是部分视频列表:

UniqueId: {uniqueId}{~n}
GroupName: {groupName}{~n}
<ul>
  {#videos}
<li>{name}</li>{~n}
  {/videos}
</ul>

如何从父模板调用部分 e 传递参数 uniqueId=userId、groupName=group 和 videos=userVideos(这是一个列表)。

4

1 回答 1

1

部分接受参数,因此您可以执行以下操作:

{>video_list uniqueId=userId groupName=group videos=userVideos/}
于 2013-08-15T19:55:56.023 回答