Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

扩展了2个功能 #87

Merged
merged 11 commits into from
Oct 6, 2024
Merged

扩展了2个功能 #87

merged 11 commits into from
Oct 6, 2024

Conversation

wangx036
Copy link
Contributor

  1. 支持嵌套对象的渲染
    比如:{{objA.objB.prop1}}

  2. 增加@foreach -@Endforeach循环体

循环

@foreach@endforeach tags .

Example
var value = new  
{
    LoopData = new List<object>()
    {
        new {
            Type="类型A",
            Items = new List<object>() {new {Name = "A-1"}, new {Name = "A-2"},}
        },
        new
        {
            Type="类型B",
            Items = new List<object>() {new {Name = "B-1"}, new {Name = "B-2"}, new {Name = "B-3"},}
        },
    }
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
Template

1

Result

2

@wangx036
Copy link
Contributor Author

提交信息有点杂乱,见谅

@wangx036 wangx036 closed this Sep 25, 2024
Merge pull request mini-software#85 from wangx036/MIf
@wangx036 wangx036 reopened this Sep 25, 2024
Copy link
Member

@shps951023 shps951023 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wangx036 👍👍 假日我查看是哪边导致unit test错误

@tonyjonson8748
Copy link

  1. 支持嵌套对象的渲染
    比如:{{objA.objB.prop1}}
  2. 增加@foreach -@Endforeach循环体

循环

@foreach@endforeach tags .

Example
var value = new  
{
    LoopData = new List<object>()
    {
        new {
            Type="类型A",
            Items = new List<object>() {new {Name = "A-1"}, new {Name = "A-2"},}
        },
        new
        {
            Type="类型B",
            Items = new List<object>() {new {Name = "B-1"}, new {Name = "B-2"}, new {Name = "B-3"},}
        },
    }
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
Template

1

Result

2

我发现当@foreach dataList, 这个被遍历的对象如果数量为0的时候,会将模板原样输出,而不是直接忽视@foreach @Endforeach里面的内容

@wangx036
Copy link
Contributor Author

@tonyjonson8748 已修复🤝🤝🤝

@shps951023 shps951023 merged commit 3428cbd into mini-software:main Oct 6, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants