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

Google Wallet通用类双项行不显示,寻求添加多行方案

解决Google Wallet卡片正面添加双项行的问题

核心问题原因

你使用的cardRowTemplateInfos配置是用于卡片详情页的行模板,并非卡片正面的展示区域。要在卡片正面添加2-3行内容,需要使用cardTemplateOverride下的cardPrimaryRowTemplateInfo、cardSecondaryRowTemplateInfo或cardAuxiliaryRowTemplateInfo字段,这些字段分别对应卡片正面的主行、次行、辅助行区域。

具体修改方案

以下是调整后的代码示例,可实现卡片正面添加2-3行双项/单行内容:

'classTemplateInfo': {
  'cardTemplateOverride': {
    // 正面主行:双项内容
    'cardPrimaryRowTemplateInfo': {
      'twoItems': {
        'startItem': {
          'firstValue': {
            'fields': [{'fieldPath': 'object.textModulesData["company"]'}]
          }
        },
        'endItem': {
          'firstValue': {
            'fields': [{'fieldPath': 'object.textModulesData["badgeId"]'}]
          }
        }
      }
    },
    // 正面次行:双项内容
    'cardSecondaryRowTemplateInfo': {
      'twoItems': {
        'startItem': {
          'firstValue': {
            'fields': [{'fieldPath': 'object.textModulesData["department"]'}]
          }
        },
        'endItem': {
          'firstValue': {
            'fields': [{'fieldPath': 'object.textModulesData["expiryDate"]'}]
          }
        }
      }
    },
    // 正面辅助行:单行内容(也可改为双项)
    'cardAuxiliaryRowTemplateInfo': {
      'oneItem': {
        'firstValue': {
          'fields': [{'fieldPath': 'object.textModulesData["location"]'}]
        }
      }
    }
  }
}

关键注意事项

  • 确保你的卡片对象数据中已正确配置对应的textModulesData字段,示例如下:
    'textModulesData': [
      {'header': '公司', 'body': 'XX科技', 'id': 'company'},
      {'header': '徽章ID', 'body': 'BADGE-001', 'id': 'badgeId'},
      {'header': '部门', 'body': '研发部', 'id': 'department'},
      {'header': '有效期', 'body': '2025-12-31', 'id': 'expiryDate'},
      {'header': '地点', 'body': '北京总部', 'id': 'location'}
    ]
    
  • 每个行模板(主/次/辅助)只能选择一种类型:oneItem(单行)或twoItems(双项行),不可混合配置。
  • 卡片正面最多支持3行内容(主+次+辅助),超出的内容会自动被放到详情页展示。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 02:43:11