You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为SharePoint列表设置可点击跳转的图片链接

SharePoint列表Tile Formatting实现可点击图片跳转

要让列表中的图片成为可点击的超链接,只需将图片元素嵌套到链接标签内部即可。修改后的Tile Formatting代码如下:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/tile-formatting.schema.json",
  "hideSelection": true,
  "width": "355",
  "height": "355",
  "formatter": {
    "elmType": "div",
    "children": [
      {
        "elmType": "div",
        "style": {
          "display": "inline-block",
          "min-width": "355px",
          "min-height": "355px",
          "margin-right": "10px",
          "box-shadow": "2px 2px 4px darkgrey"
        },
        "children": [
          {
            "elmType": "a",
            "style": {
              "border": "none",
              "display": "block",
              "cursor": "pointer"
            },
            "attributes": {
              "target": "_blank",
              "href": "[$Link]"
            },
            "children": [
              {
                "elmType": "img",
                "attributes": {
                  "src": "[$Image.serverRelativeUrl]"
                },
                "style": {
                  "height": "360px",
                  "max-width": "360px"
                }
              }
            ]
          }
        ]
      }
    ]
  }
}

关键修改说明:

  • 将<img>元素移入<a>标签的children数组,让链接完全包裹图片,点击图片即可触发跳转
  • 给<a>标签添加display: block样式,确保链接区域覆盖整个图片,避免点击图片边缘无效
  • 如果需要保留底部的"Click here"文字,可将文字元素添加到<a>标签的children中,调整样式让它显示在图片下方

内容的提问来源于stack exchange,提问作者SOny

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 08:37:48