1.直接上代码
<template>
<view class="content">
<button type="default" @click="onSinngle">单张压缩</button>
<image class="image" :src="single" mode="aspectFill"></image>
<button type="default" @click="onMulti">多张压缩</button>
<block v-for="(item, idx) in multi" :key="idx">
<image class="image" :src="item" mode="aspectFill"></image>
</block>
<w-compress ref='wCompress' />
</view>
</template>
import WCompress from '@/components/w-compress/w-compress.vue'
export default {
components: {
WCompress
},
data() {
return {
multi: [],
single: ''