Skip to content

Commit 04741bb

Browse files
二一7insummer
authored andcommitted
feat:新增设置toast偏移量属性 (#296)
1 parent 671f572 commit 04741bb

File tree

7 files changed

+28
-10
lines changed

7 files changed

+28
-10
lines changed

dist/toast/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Component({
6868
type: Boolean,
6969
value: true,
7070
},
71+
offsetX:Number,
72+
offsetY:Number
7173

7274
},
7375

@@ -118,7 +120,9 @@ Component({
118120
center = true,
119121
mask = false,
120122
success = null,
121-
complete = null
123+
complete = null,
124+
offsetX = 0,
125+
offsetY = 0 ,
122126
} = options;
123127
this.setData({
124128
title,
@@ -132,7 +136,9 @@ Component({
132136
mask,
133137
show: true,
134138
success,
135-
complete
139+
complete,
140+
offsetY,
141+
offsetX
136142
});
137143
this.changeStatus();
138144
return this;

dist/toast/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
hidden="{{!status}}"
77
style="z-index:{{zIndex}}">
88
<view class="toast-bg" wx:if="{{mask}}"></view>
9-
<view class="toast toast-{{placement || 'bottom'}}" style="{{placement || 'bottom' === 'bottom' ? image || icon ? 'padding-top: 25rpx': '': ''}}" >
9+
<view class="toast toast-{{placement || 'bottom'}}" style="padding-top:{{(placement || 'bottom')=== 'bottom' ? image || icon ? '25rpx': '': ''}};position:relative;left:{{offsetX}}rpx;top:{{offsetY}}rpx" >
1010
<image class="toast-icon"
1111
wx:if="{{image}}"
1212
src="{{image}}"

examples/dist/toast/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Component({
6868
type: Boolean,
6969
value: true,
7070
},
71+
offsetX:Number,
72+
offsetY:Number
7173

7274
},
7375

@@ -118,7 +120,9 @@ Component({
118120
center = true,
119121
mask = false,
120122
success = null,
121-
complete = null
123+
complete = null,
124+
offsetX = 0,
125+
offsetY = 0 ,
122126
} = options;
123127
this.setData({
124128
title,
@@ -132,7 +136,9 @@ Component({
132136
mask,
133137
show: true,
134138
success,
135-
complete
139+
complete,
140+
offsetY,
141+
offsetX
136142
});
137143
this.changeStatus();
138144
return this;

examples/dist/toast/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
hidden="{{!status}}"
77
style="z-index:{{zIndex}}">
88
<view class="toast-bg" wx:if="{{mask}}"></view>
9-
<view class="toast toast-{{placement || 'bottom'}}" style="{{placement || 'bottom' === 'bottom' ? image || icon ? 'padding-top: 25rpx': '': ''}}" >
9+
<view class="toast toast-{{placement || 'bottom'}}" style="padding-top:{{(placement || 'bottom')=== 'bottom' ? image || icon ? '25rpx': '': ''}};position:relative;left:{{offsetX}}rpx;top:{{offsetY}}rpx" >
1010
<image class="toast-icon"
1111
wx:if="{{image}}"
1212
src="{{image}}"

examples/pages/components/response/pages/toast/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
placement="{{currentConf.placement}}"
3232
duration="{{currentConf.duration}}"
3333
center="{{currentConf.center}}"
34-
mask="{{currentConf.mask}}"
34+
mask="{{currentConf.mask}}"
3535
/>
3636

3737
</view>

src/toast/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Component({
6868
type: Boolean,
6969
value: true,
7070
},
71+
offsetX:Number,
72+
offsetY:Number
7173

7274
},
7375

@@ -118,7 +120,9 @@ Component({
118120
center = true,
119121
mask = false,
120122
success = null,
121-
complete = null
123+
complete = null,
124+
offsetX = 0,
125+
offsetY = 0 ,
122126
} = options;
123127
this.setData({
124128
title,
@@ -132,7 +136,9 @@ Component({
132136
mask,
133137
show: true,
134138
success,
135-
complete
139+
complete,
140+
offsetY,
141+
offsetX
136142
});
137143
this.changeStatus();
138144
return this;

src/toast/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
hidden="{{!status}}"
77
style="z-index:{{zIndex}}">
88
<view class="toast-bg" wx:if="{{mask}}"></view>
9-
<view class="toast toast-{{placement || 'bottom'}}" style="{{placement || 'bottom' === 'bottom' ? image || icon ? 'padding-top: 25rpx': '': ''}}" >
9+
<view class="toast toast-{{placement || 'bottom'}}" style="padding-top:{{(placement || 'bottom')=== 'bottom' ? image || icon ? '25rpx': '': ''}};position:relative;left:{{offsetX}}rpx;top:{{offsetY}}rpx" >
1010
<image class="toast-icon"
1111
wx:if="{{image}}"
1212
src="{{image}}"

0 commit comments

Comments
 (0)