1.0.1 • Published 1 year ago

imgcompress-hcy v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

imgcompress-hcy ⚡

介绍

一个图片压缩的方法(可以指点宽度和高度,尺寸)并且不会失真

使用

npm 引入

npm install imgcompress-hcy

导入

import compressImage from 'imgcompress-hcy';

props 参数说明

参数类型说明必须
widthnumber单位是pxtrue
heightnumber单位是pxtrue
targetSizenumber单位是kbtrue
filefile图片文件true

使用示例

<template>
     <input type="file" @change="onFileChange">
</template>

<script setup>

import compressImage from 'imgcompress-hcy';

const onFileChange = async (e)=>{
 let res = await  compressImage(800,800,200,e.target.files[0])
 console.log(res);
}
</script>
1.0.1

1 year ago

1.0.0

1 year ago