老马搞的,我看看。需要注意以下几要点:
复制功能 需要使用https。
下载功能 需要配合一般需要以下一些头部信息配合:
Header(‘Pragma: public’); // required
Header(‘Expires: 0’); // no cache
Header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0’);
Header(‘Cache-Control: private’,false);
Header(‘Content-Type: application/force-download’);
Header(‘Content-Disposition: attachment; filename=”‘. urlencode($_GET[‘down’]).’.png”‘);
Header(‘Content-Transfer-Encoding: binary’);
Header(‘Connection: close’);
group-button-on-image 这个样式很高级。
{
"type": "group",
"className": "group-button-on-image",
"body": [{
"type": "image",
"className": "qr-code-${id}",
"src": "${qrcode}"
},
{
"type": "button",
"label": "下载",
"level": "primary",
"onEvent": {
"click": {
"weight": 0,
"actions": [{
"ignoreError": false,
"actionType": "download",
"api": {
"url": "${qrcode}",
"silent": true,
"responseType": "blob"
}
}]
}
}
},
{
"type": "button",
"label": "复制",
"disabledOn": "location.protocol === 'http:'",
"onEvent": {
"click": {
"actions": [{
"actionType": "custom",
"script": "props=arguments[0].props;props.context.myCopyImage('.qr-code-' + props.data.id + ' img.cxd-Image-image');"
},
{
"actionType": "toast",
"args": {
"msg": "二维码复制成功,可以粘贴到微信上了!"
}
}
]
}
}
}
]
}
发表回复
要发表评论,您必须先登录。