Skip to content
目录

微信小程序电子健康卡接入

  • 注册腾讯电子健康卡开放平台(服务商)
  • 绑定医院小程序接入

TIP

找健康卡服务小助手可加快审核速度

审核通过后添加小程序插件

miniprogram-plugin

安装插件

微信小程序:电子健康卡插件

  1. mainifest.json 中添加配置
json
"mp-weixin": {
...
  "plugins": {
    // "电子健康卡插件,需要在小程序后台添加插件"
    "healthCardPlugins": {
      "version": "3.11.2",
      "provider": "wxee969de81bba9a45",
    }
  }
},
  1. pages.json 中添加组件 (只能在微信中使用,按需引入)

指南:将在插件配置在 globalStyle 中

有两种配置方式:子组件按需引入、全局注册

子组件按需引入

按需引入的缺点

当子组件使用插件,被父组件引入时是不生效的,这时只能通过全局注册才有用。

json
{
  "pages" : [
    ...
    {
      "path": "pages/venders/wechatMini/healthCard",
      "style": {
        "mp-weixin": {
          "usingComponents": {
            "health-card-login": "plugin://healthCardPlugins/healthCardLogin",
            "health-card-users": "plugin://healthCardPlugins/healthCardUsers",
            "health-card-create-card": "plugin://healthCardPlugins/healthCardCreateCard"
          }
        }
      }
    }
  ]
}

全局注册

json
{
  "globalStyle": {
    "mp-weixin": {
      ...
      "backgroundColor": "#f9f9f9",
      "usingComponents": {
        "health-card-login": "plugin://healthCardPlugins/healthCardLogin",
        "health-card-users": "plugin://healthCardPlugins/healthCardUsers",
        "health-card-create-card": "plugin://healthCardPlugins/healthCardCreateCard"
      }
    }
  }
}

好大夫互联网科技(广州)有限公司.