Visualforce-2.内置组件(components)

1.Visualforce内置组件(built-in components)

Visualforce 拥有近 150 个内置组件,可提供各种用户界面元素和行为。

Visualforce 标准组件( Standard Component Reference )引用中列出了这些组件,并记录了它们的属性,包括如何使用组件的示例代码。

示例代码:

<apex:page sidebar="false" showHeader="false">
    <h1>Hello World</h1>
</apex:page>

※sidebar 和 showHeader 属性在 Lightning Experience 中无效,并且无法抑制 Lightning Experience 标头。虽然 showHeader 默认值是 true,但是它对 Lightning Experience 无效。

Note that both the sidebar and showHeader attribute have no effect in Lightning Experience, and that there’s no way to suppress the Lightning Experience header. Although the default value of showHeader is true, it has no effect in Lightning Experience.


页面包含一些 Salesforce 样式表,可让您匹配 Salesforce 选择的字体、大小等。要抑制 Salesforce 的所有输出,同样需要添加 standardStylesheets="false" 来删除样式。
The page still includes some Salesforce style sheets, which let you match Salesforce choices for fonts, size, and so on. To suppress all Salesforce output, add standardStylesheets="false" to remove the styles as well.

2.迭代组件<apex:repeat>

  • Use the apex:outputLink component to link to the respective record detail page
  •  Record detail pages can be reached by placing a record ID at the root of the URL (e.g. <record id>)

示例代码:

<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock >
        <apex:repeat value="{! accounts}" var="a">
            <ul>
                <li>
                    <apex:outputLink value="{! URLFOR($Action.Account.View,a.Id)}">
                        {!a.name}
                    </apex:outputLink>
                </li>
            </ul>            
        </apex:repeat>
    </apex:pageBlock>
</apex:page>

预览结果:

 点击任意link,显示该Account的详细页面

 

Resources

posted @ 2022-05-07 00:24  KousaiMiao  阅读(54)  评论(0编辑  收藏  举报