File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import computeOffset from '../behaviors/computeOffset' ;
22import zIndex from '../behaviors/zIndex' ;
33import watchShow from '../behaviors/watchShow' ;
4+
45Component ( {
56 /**
67 * 组件的属性列表
@@ -91,43 +92,13 @@ Component({
9192 initToast ( ) {
9293 wx . lin = wx . lin || { } ;
9394 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 ) ;
12597 return this ;
12698 } ;
12799 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 ( ) ;
131102 } ;
132103 } ,
133104
@@ -165,6 +136,58 @@ Component({
165136 }
166137
167138 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+ } ) ;
168191 }
169192 }
170- } ) ;
193+ } ) ;
You can’t perform that action at this time.
0 commit comments