该 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,该 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