代码比较简单,为了方便以后copy用,存一下
调用
复制代码
1
2
3<preview-local-pictures :img="require('../static/images/exampleImg.jpg')" @close="showPreview(false)" :show="previewFlag"></preview-local-pictures>
组件内容
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50<!-- 预览本地图片组件--> <template> <view class="preview-local-pictures" @click="close" v-if="show"> <img :src="img" alt="" srcset=""></img> </view> </template> <script> export default { name: "previewLocalPictures", props: { // 展示 show: { type: Boolean, default: false }, // 图片地址 img: { type: String, default: '' } }, methods: { // 关闭弹窗 close(){ this.$emit('close') } } } </script> <style scoped lang="scss"> .preview-local-pictures { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; background-color: #000000; z-index: 999; display: flex; flex-direction: row; align-items: center; justify-content: center; animation:fadenum 0.5s; @keyframes fadenum { 0%{opacity: 0;} 100%{opacity: 1;} } } </style>
最后
以上就是跳跃烤鸡最近收集整理的关于uniapp预览一张本地图片组件封装代码比较简单,为了方便以后copy用,存一下调用组件内容的全部内容,更多相关uniapp预览一张本地图片组件封装代码比较简单内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复