linkage 列显示一个指向指定页面的超链接。
website:
label: Website
type: linkage以下属性受支持。
| Property | Description |
|---|---|
| linkText | text to display for the link, optional. |
| linkUrl | provide a URL instead of taking it from the record value |
| attributes | an array of HTML attributes to pass to the anchor element. |
使用 attributes 属性来添加自定义 HTML 属性。
website:
label: Website
type: linkage
attributes:
target: _blank此
linkage列类型将自动解析 页面查找器链接值。
使用 linkUrl 和 linkText 显式提供一个 URL,它可以是后端 URI 或完全限定的 URL。记录中的属性将自动解析。
open_link:
label: View
type: linkage
linkText: View Dashboard
linkUrl: backend/index/:code/:id默认情况下,该值将是链接位置的 URL。例如,您可以通过从模型返回一个数组值来更改链接文本。
['https://octobercms.com', 'October CMS']在您的模型中,您可能希望使用属性修饰符来提供这些值。以下将在模型上创建一个新的 website_link 属性。
public function getWebsiteLinkAttribute()
{
return [$this->url, $this->name];
}您可以使用 displayFrom 属性,以保持对数据库值进行排序和搜索的完整性。以下将使用 website 属性进行搜索和排序,并使用 website_link 属性显示链接。
website:
label: Website
type: linkage
displayFrom: website_link