12345678910111213141516171819202122232425262728 |
- export default function ({ $userAgent }, i) {
- const before = () => {
- if ($userAgent.isApp) {
- return;
- }
- // else if ($userAgent.isMiniProgram) {
- // throw new Error('小程序环境不支持');
- // }
- throw new Error('非App环境');
- };
- i('native', {
- share({ title, content, gotoUrl, shareImg }) {
- before();
- if ($userAgent.isIos) {
- window.webkit.messageHandlers.share.postMessage({
- title,
- content,
- gotoUrl,
- shareImg,
- });
- } else {
- window.native.share(title, content, gotoUrl, shareImg);
- }
- },
- });
- }
|