通过 blockcomponent将数据压入页面中,在MyFirstComponent类中处理参数
获取方式使用Context.ComponentParameters["Params"];
Example
#component(MyFirstComponent "%{firstParam='some value',anotherParam='other value'}")You can then access the parameters from the component code: 
public class MyFirstComponent: ViewComponent
...{
public override void Render()
...{
object param1 = Context.ComponentParameters["firstParam"];
object param2 = Context.ComponentParameters["anotherParam"];
...
}
}
本文介绍了一种通过blockcomponent向页面传递数据的方法,并展示了如何在MyFirstComponent类中使用Context.ComponentParameters来获取这些参数。具体例子包括设置firstParam和anotherParam两个参数,并在组件代码中进行访问。
3940

被折叠的 条评论
为什么被折叠?



