File tree Expand file tree Collapse file tree 1 file changed +58
-35
lines changed Expand file tree Collapse file tree 1 file changed +58
-35
lines changed Original file line number Diff line number Diff line change 1
1
import computeOffset from '../behaviors/computeOffset' ;
2
2
import zIndex from '../behaviors/zIndex' ;
3
3
import watchShow from '../behaviors/watchShow' ;
4
+
4
5
Component ( {
5
6
/**
6
7
* 组件的属性列表
@@ -91,43 +92,13 @@ Component({
91
92
initToast ( ) {
92
93
wx . lin = wx . lin || { } ;
93
94
wx . lin . showToast = ( options = { } ) => {
94
- const {
95
- title = '' ,
96
- icon = '' ,
97
- image = '' ,
98
- placement = 'bottom' ,
99
- duration = 1500 ,
100
- center = true ,
101
- mask = false ,
102
- success = null ,
103
- complete = null ,
104
- offsetX = 0 ,
105
- offsetY = 0 ,
106
- iconSize = '60' ,
107
- iconColor = ''
108
- } = options ;
109
- this . setData ( {
110
- title,
111
- icon,
112
- image,
113
- placement,
114
- duration,
115
- center,
116
- mask,
117
- success,
118
- complete,
119
- offsetY,
120
- offsetX,
121
- iconSize,
122
- iconColor
123
- } ) ;
124
- this . changeStatus ( ) ;
95
+ console . warn ( 'wx.lin 已废弃,请使用开放函数代替:https://doc.mini.talelin.com//start/open-function.html' ) ;
96
+ this . linShow ( options ) ;
125
97
return this ;
126
98
} ;
127
99
wx . lin . hideToast = ( ) => {
128
- this . setData ( {
129
- status : false
130
- } ) ;
100
+ console . warn ( 'wx.lin 已废弃,请使用开放函数代替:https://doc.mini.talelin.com//start/open-function.html' ) ;
101
+ this . linHide ( ) ;
131
102
} ;
132
103
} ,
133
104
@@ -165,6 +136,58 @@ Component({
165
136
}
166
137
167
138
this . triggerEvent ( 'lintap' , detail , option ) ;
139
+ } ,
140
+
141
+ // ========== 开放函数 =============
142
+
143
+ /**
144
+ * 显示 toast
145
+ * @param options toast 参数
146
+ */
147
+ linShow ( options ) {
148
+ if ( ! options ) {
149
+ options = { } ;
150
+ }
151
+ const {
152
+ title = '' ,
153
+ icon = '' ,
154
+ image = '' ,
155
+ placement = 'bottom' ,
156
+ duration = 1500 ,
157
+ center = true ,
158
+ mask = false ,
159
+ success = null ,
160
+ complete = null ,
161
+ offsetX = 0 ,
162
+ offsetY = 0 ,
163
+ iconSize = '60' ,
164
+ iconColor = ''
165
+ } = options ;
166
+ this . setData ( {
167
+ title,
168
+ icon,
169
+ image,
170
+ placement,
171
+ duration,
172
+ center,
173
+ mask,
174
+ success,
175
+ complete,
176
+ offsetY,
177
+ offsetX,
178
+ iconSize,
179
+ iconColor
180
+ } ) ;
181
+ this . changeStatus ( ) ;
182
+ } ,
183
+
184
+ /**
185
+ * 隐藏 toast
186
+ */
187
+ linHide ( ) {
188
+ this . setData ( {
189
+ status : false
190
+ } ) ;
168
191
}
169
192
}
170
- } ) ;
193
+ } ) ;
You can’t perform that action at this time.
0 commit comments