我试图添加一个包装器,它将一个方法添加到一个类中,该类将返回传递给包装器的参数的值,这是我想要实现的:
@inherits Umbraco.Web.Mvc.UmbracoViewPage<dynamic>
<div class="carousel owl-carousel carousel-content">
@{
foreach (var tmp in Model.value.carousel.Children())
{
<div class="item">
@{
var id = @tmp.id.ToString();
var mediaItem = Umbraco.Media(id);
var linkText = @mediaItem.GetPropertyValue("linkText");
var linkUrl = @mediaItem.GetPropertyValue("linkUrl");
var linkTitle = @mediaItem.GetPropertyValue("linkTitle");
}
<img src="@mediaItem.url" />
<div class="content-container">
<div class="content">
@if (!string.IsNullOrWhiteSpace(linkText))
{
<h2>@linkText</h2>
}
@if (!string.IsNullOrWhiteSpace(linkUrl))
{
<a class="btn btn-primary backdrop" href="@linkUrl">@linkTitle</a>
}
</div>
</div>
</div>
}
}
</div>
预期产出:
@addMethod(test='abs')
class a(object):
def method1(cls):
pass
def method2(cls):
pass
def addMethod(*kwargs):
def getTest():
return kwargs.get('test')
return getTest
def main():
x = a()
print x.getTest()
我认为我的包装器应该继承一个具有该方法的新类,但这看起来并不正确:
abc
任何可能导致我正确方向的想法或暗示?