vue使用预览插件实现图片预览

1.安装依赖

cnpm install --save-picture-preview

2.在main.js中引入vue-picture-preview

import vuePicturePreview from 'vue-picture-preview'  //引入图片查看器

3.在main.js中调用

Vue.use(vuePicturePreview);

4.在根组件中放置


啰嗦几句,一定是根组件中!!!我一开始放错地方了,一直没法预览,一不小心进坑了!
我的项目根组件是App.vue,html代码如下


配置完了,就可以在页面中正常使用了










参考链接

你可能感兴趣的:(vue使用预览插件实现图片预览)