vue3-watermark-camera
Version:
A Vue 3 component for taking photos with watermark support
64 lines (63 loc) • 1.74 kB
TypeScript
export interface WatermarkInfo {
address: string;
time: string;
lat: number;
lng: number;
name?: string;
company?: string;
}
export interface LocationResult {
latitude: number;
longitude: number;
address?: string;
}
export interface WatermarkCameraProps {
modelValue?: string;
name?: string;
company?: string;
action?: string;
amapKey?: string;
watermarkConfig?: {
showTime?: boolean;
showLocation?: boolean;
showName?: boolean;
showCompany?: boolean;
backgroundColor?: string;
textColor?: string;
fontSize?: number;
};
locationConfig?: {
enableLocation?: boolean;
locationProvider?: 'h5' | 'dingtalk' | 'custom';
customLocationFn?: () => Promise<LocationResult>;
};
timeConfig?: {
enableNetworkTime?: boolean;
networkTimeUrl?: string;
customTimeFn?: () => Promise<string>;
};
uploadConfig?: {
enableAutoUpload?: boolean;
customUploadFn?: (file: File) => Promise<any>;
};
cameraConfig?: {
enableCamera?: boolean;
customCameraFn?: () => Promise<string>;
};
}
export interface WatermarkCameraEmits {
'update:modelValue': [value: string];
'upload-success': [data: any];
'location-success': [location: LocationResult];
'location-error': [error: any];
'time-success': [time: string];
'time-error': [error: any];
'camera-success': [filePath: string];
'camera-error': [error: any];
}
export interface WatermarkCameraExpose {
takePhoto: () => Promise<void>;
deletePhoto: () => void;
getLocation: () => Promise<LocationResult>;
getNetworkTime: () => Promise<string>;
}