File tree Expand file tree Collapse file tree 4 files changed +52
-6
lines changed
Expand file tree Collapse file tree 4 files changed +52
-6
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,12 @@ npm run dev
8585
8686### 版本日志
8787
88+ #### v1.0.2
89+ * 基于 ` mpvue 1.0.7 `
90+ * ` uploader ` 组件增加删除功能
91+
8892#### v1.0.1
93+ * 基于 ` mpvue 1.0.7 `
8994* 增加` swiper ` 组件
9095
9196#### v1.0.0
Original file line number Diff line number Diff line change 11![ logo] ( _img/mpvue-logo.png )
22<!--  -->
3- # mpvue-weui <small >1.0.2 </small >
3+ # mpvue-weui <small >1.0.3 </small >
44
55> 基于 <a href =" https://github.com/Meituan-Dianping/mpvue " style =" border-bottom :0 ; " >mpvue</a > 框架,重写 WeUI
66
Original file line number Diff line number Diff line change 11{
22 "name" : " mpvue-weui" ,
3- "version" : " 1.0.2 " ,
3+ "version" : " 1.0.3 " ,
44 "description" : " 用 vue 写小程序,使用 mpvue 框架重写 WeUI。" ,
55 "author" : " kuangpengfei <kuangpf1995@gmail.com>" ,
66 "private" : false ,
Original file line number Diff line number Diff line change 1616 <div class =" weui-uploader__bd" >
1717 <div class =" weui-uploader__files" id =" uploaderFiles" >
1818 <block v-for =" item in files" :key =" index" >
19- <div class =" weui-uploader__file" @click =" predivImage" :id =" item" >
20- <image class =" weui-uploader__img" :src =" item" mode =" aspectFill" />
19+ <div class =" weui-uploader__file" >
20+ <image class =" weui-uploader__img" :src =" item" mode =" aspectFill" @click =" predivImage" :id =" item" />
21+ <div class =" delete-icon" @click =" deleteImg" :id =" item" ></div >
2122 </div >
2223 </block >
2324 <div class =" weui-uploader__file" >
@@ -61,7 +62,7 @@ export default {
6162 },
6263 methods: {
6364 chooseImage (e ) {
64- var _this = this ;
65+ let _this = this ;
6566 wx .chooseImage ({
6667 count: 1 , // 默认9
6768 sizeType: [' original' , ' compressed' ], // 可以指定是原图还是压缩图,默认二者都有
@@ -85,11 +86,51 @@ export default {
8586 current: e .currentTarget .id , // 当前显示图片的http链接
8687 urls: this .files // 需要预览的图片http链接列表
8788 })
89+ },
90+ deleteImg (e ) {
91+ Array .prototype .indexOf = function (val ) {
92+ for (let i = 0 ; i < this .length ; i++ ) {
93+ if (this [i] == val) return i;
94+ }
95+ return - 1 ;
96+ };
97+ Array .prototype .remove = function (val ) {
98+ let index = this .indexOf (val);
99+ if (index > - 1 ) {
100+ this .splice (index, 1 );
101+ }
102+ };
103+ this .files .remove (e .currentTarget .id );
88104 }
89105 }
90106}
91107 </script >
92108
93109<style >
94-
110+ .weui-uploader__file {
111+ position : relative ;
112+ }
113+ .weui-uploader__bd {
114+ overflow : visible ;
115+ }
116+ .delete-icon {
117+ position : absolute ;
118+ width : 40 rpx;
119+ height : 40 rpx;
120+ background : #f43530 ;
121+ right : 0 ;
122+ top : -20 rpx;
123+ border-radius : 40 rpx;
124+ z-index : 5 ;
125+ }
126+ .delete-icon ::before {
127+ content : " " ;
128+ width : 26 rpx;
129+ height : 4 rpx;
130+ position : absolute ;
131+ top : 50% ;
132+ left : 50% ;
133+ transform : translate (-50% , -50% );
134+ background : #fff ;
135+ }
95136 </style >
You can’t perform that action at this time.
0 commit comments