使用vue-preview做图片缩率图
1.安装 npm i vue-preview -S
2.如果使用vue-cli生成的项目,需要修改webpack.base.conf.js文件中的loaders,添加一个loader
{
test:/vue-preview.src.*?js$/,
loader:'babel'
}

3.导入:import VuePreview from 'vue-preview'

使用: Vue.use(VuePreview)


<div class="thumbs">
<img class="preview-img" v-for="(item, index) in list" :src="item.src" height="100" @click="$preview.open(index, list)" :key="item.src">
</div>


注意:img标签上的class="preview-img" 不能去掉,图片要设置宽和高

相关文章:

  • 2021-12-05
  • 2022-12-23
  • 2021-10-28
  • 2021-06-10
  • 2021-11-27
  • 2021-07-23
  • 2022-12-23
猜你喜欢
  • 2021-09-03
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案