程序二维码分享组件, 支持传入size 显示二维码大小

This commit is contained in:
wkj 2025-09-13 17:29:48 +08:00
parent 983d55e97a
commit d89a0a27ef
24 changed files with 39 additions and 25 deletions

View File

@ -3,7 +3,7 @@
<image src="{{url}}" mode="aspectFit" class="image" />
</block>
<block wx:elif="{{qrcodeURL}}">
<image class="image" src="{{qrcodeURL}}" mode="aspectFit" class="image" />
<image src="{{qrcodeURL}}" mode="aspectFit" class="image" />
</block>
<block wx:if="{{expiresAtStr}}">

View File

@ -1,4 +1,5 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "userEntityGrant", false, {
disableDownload: boolean;
size: number;
}>) => React.ReactElement;
export default _default;

View File

@ -69,5 +69,6 @@ export default OakComponent({
},
properties: {
disableDownload: false,
size: 280,
},
});

View File

@ -5,7 +5,7 @@
<l-loading show="{{true}}" type="circle"></l-loading>
</block>
<block wx:elif="{{url}}">
<qrCode url="{{url}}" expiresAt="{{expiresAt}}" disableDownload="{{disableDownload}}" />
<qrCode url="{{url}}" expiresAt="{{expiresAt}}" disableDownload="{{disableDownload}}" size="{{size}}" />
</block>
<block wx:else>
</block>

View File

@ -5,4 +5,5 @@ export default function Render(props: WebComponentProps<EntityDict, 'userEntityG
url: string;
expiresAt: number;
disableDownload: boolean;
size: number;
}, {}>): React.JSX.Element | null;

View File

@ -2,12 +2,12 @@ import React from 'react';
import QrCode from '../../common/qrCode';
import { DotLoading } from 'antd-mobile';
export default function Render(props) {
const { url, expiresAt, oakLoading, disableDownload } = props.data;
const { url, expiresAt, oakLoading, disableDownload, size } = props.data;
if (oakLoading) {
return <DotLoading color="primary"/>;
}
if (url) {
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload}/>;
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} size={size}/>;
}
return null;
}

View File

@ -5,4 +5,5 @@ export default function Render(props: WebComponentProps<EntityDict, 'userEntityG
url: string;
expiresAt: number;
disableDownload: boolean;
size: number;
}, {}>): React.JSX.Element | null;

View File

@ -2,12 +2,12 @@ import React from 'react';
import QrCode from '../../common/qrCode';
import { Spin } from 'antd';
export default function Render(props) {
const { url, expiresAt, oakLoading, disableDownload } = props.data;
const { url, expiresAt, oakLoading, disableDownload, size } = props.data;
if (oakLoading) {
return <Spin />;
}
if (url) {
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload}/>;
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} size={size}/>;
}
return null;
}

View File

@ -1,4 +1,5 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "wechatQrCode", false, {
disableDownload: boolean;
size: number;
}>) => React.ReactElement;
export default _default;

View File

@ -45,6 +45,7 @@ export default OakComponent({
};
},
properties: {
disableDownload: false
disableDownload: false,
size: 280
}
});

View File

@ -5,7 +5,7 @@
<l-loading show="{{true}}" type="circle"></l-loading>
</block>
<block wx:elif="{{url}}">
<qrCode url="{{url}}" expiresAt="{{expiresAt}}" disableDownload="{{disableDownload}}" />
<qrCode url="{{url}}" expiresAt="{{expiresAt}}" disableDownload="{{disableDownload}}" size="{{size}}" />
</block>
<block wx:else>
</block>

View File

@ -5,4 +5,5 @@ export default function Render(props: WebComponentProps<EntityDict, 'wechatQrCod
url: string;
expiresAt: number;
disableDownload: boolean;
size: number;
}, {}>): React.JSX.Element | null;

View File

@ -2,12 +2,12 @@ import React from 'react';
import QrCode from '../../common/qrCode';
import { DotLoading } from 'antd-mobile';
export default function Render(props) {
const { url, expiresAt, oakLoading, disableDownload } = props.data;
const { url, expiresAt, oakLoading, disableDownload, size } = props.data;
if (oakLoading) {
return <DotLoading color="primary"/>;
}
if (url) {
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload}/>;
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} size={size}/>;
}
return null;
}

View File

@ -5,4 +5,5 @@ export default function Render(props: WebComponentProps<EntityDict, 'wechatQrCod
url: string;
expiresAt: number;
disableDownload: boolean;
size: number;
}, {}>): React.JSX.Element | null;

View File

@ -2,12 +2,12 @@ import React from 'react';
import QrCode from '../../common/qrCode';
import { Spin } from 'antd';
export default function Render(props) {
const { url, expiresAt, oakLoading, disableDownload } = props.data;
const { url, expiresAt, oakLoading, disableDownload, size } = props.data;
if (oakLoading) {
return <Spin />;
}
if (url) {
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload}/>;
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} size={size}/>;
}
return null;
}

View File

@ -3,7 +3,7 @@
<image src="{{url}}" mode="aspectFit" class="image" />
</block>
<block wx:elif="{{qrcodeURL}}">
<image class="image" src="{{qrcodeURL}}" mode="aspectFit" class="image" />
<image src="{{qrcodeURL}}" mode="aspectFit" class="image" />
</block>
<block wx:if="{{expiresAtStr}}">

View File

@ -71,5 +71,6 @@ export default OakComponent({
},
properties: {
disableDownload: false,
size: 280,
},
});

View File

@ -5,7 +5,7 @@
<l-loading show="{{true}}" type="circle"></l-loading>
</block>
<block wx:elif="{{url}}">
<qrCode url="{{url}}" expiresAt="{{expiresAt}}" disableDownload="{{disableDownload}}" />
<qrCode url="{{url}}" expiresAt="{{expiresAt}}" disableDownload="{{disableDownload}}" size="{{size}}" />
</block>
<block wx:else>
</block>

View File

@ -13,16 +13,17 @@ export default function Render(
url: string;
expiresAt: number;
disableDownload: boolean;
size: number;
},
{}
>
) {
const { url, expiresAt, oakLoading, disableDownload } = props.data;
const { url, expiresAt, oakLoading, disableDownload, size } = props.data;
if (oakLoading) {
return <Spin />;
}
if (url) {
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} />;
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} size={size} />;
}
return null;
}

View File

@ -13,16 +13,17 @@ export default function Render(
url: string;
expiresAt: number;
disableDownload: boolean;
size: number;
},
{}
>
) {
const { url, expiresAt, oakLoading, disableDownload } = props.data;
const { url, expiresAt, oakLoading, disableDownload, size } = props.data;
if (oakLoading) {
return <DotLoading color="primary" />;
}
if (url) {
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} />;
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} size={size} />;
}
return null;
}

View File

@ -46,6 +46,7 @@ export default OakComponent({
};
},
properties: {
disableDownload: false
disableDownload: false,
size: 280
}
});

View File

@ -5,7 +5,7 @@
<l-loading show="{{true}}" type="circle"></l-loading>
</block>
<block wx:elif="{{url}}">
<qrCode url="{{url}}" expiresAt="{{expiresAt}}" disableDownload="{{disableDownload}}" />
<qrCode url="{{url}}" expiresAt="{{expiresAt}}" disableDownload="{{disableDownload}}" size="{{size}}" />
</block>
<block wx:else>
</block>

View File

@ -12,17 +12,18 @@ export default function Render(
{
url: string;
expiresAt: number;
disableDownload: boolean
disableDownload: boolean;
size: number;
},
{}
>
) {
const { url, expiresAt, oakLoading, disableDownload } = props.data;
const { url, expiresAt, oakLoading, disableDownload, size } = props.data;
if (oakLoading) {
return <Spin />;
}
if (url) {
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} />;
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} size={size} />;
}
return null;
}

View File

@ -13,16 +13,17 @@ export default function Render(
url: string;
expiresAt: number;
disableDownload: boolean;
size: number;
},
{}
>
) {
const { url, expiresAt, oakLoading, disableDownload } = props.data;
const { url, expiresAt, oakLoading, disableDownload, size } = props.data;
if (oakLoading) {
return <DotLoading color="primary" />;
}
if (url) {
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} />;
return <QrCode url={url} expiresAt={expiresAt} disableDownload={disableDownload} size={size} />;
}
return null;
}