ant-design-vue/components/qrcode/interface.ts

50 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-03-03 06:56:23 +00:00
import { objectType, stringType } from '../_util/type';
2023-03-03 08:58:47 +00:00
2023-03-13 07:22:48 +00:00
export interface ImageSettings {
src: string;
height: number;
width: number;
excavate: boolean;
x?: number;
y?: number;
}
2023-03-03 06:56:23 +00:00
export const qrProps = () => {
return {
size: { type: Number, default: 160 },
value: { type: String, required: true },
color: String,
includeMargin: Boolean,
imageSettings: objectType<ImageSettings>(),
};
};
2023-03-03 06:56:23 +00:00
export const qrcodeProps = () => {
return {
...qrProps(),
errorLevel: stringType<'L' | 'M' | 'Q' | 'H'>('M'),
icon: String,
iconSize: { type: Number, default: 40 },
2023-03-03 06:56:23 +00:00
status: stringType<'active' | 'expired' | 'loading'>('active'),
bordered: { type: Boolean, default: true },
};
};
2023-03-03 06:56:23 +00:00
export interface QRCodeCanvasColor {
dark?: string; // 默认#000000ff
light?: string; // 默认#ffffffff
}
export interface QRCodeCanvasOptions {
version?: number;
errorCorrectionLevel?: string; // 默认"M"
maskPattern?: number; // 遮罩符号的掩码图案
toSJISFunc?: Function; // 将汉字转换为其 Shift JIS 值的帮助程序函数
margin?: number;
scale?: number;
small?: boolean;
width: number;
color?: QRCodeCanvasColor;
}