File tree 2 files changed +11
-14
lines changed
2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @areslabs/wx-react" ,
3
- "version" : " 1.0.32 " ,
3
+ "version" : " 1.0.33 " ,
4
4
"description" : " 微信版本的React" ,
5
5
"files" : [
6
6
" miniprogram_dist" ,
Original file line number Diff line number Diff line change @@ -280,33 +280,30 @@ function parseObj(obj) {
280
280
return out ;
281
281
}
282
282
283
- function flattenArray ( arr , ans = { } ) {
284
- if ( ! Array . isArray ( arr ) ) return arr
285
-
283
+ function flattenArray ( arr , ans = [ ] ) {
284
+ if ( ! Array . isArray ( arr ) ) return arr ;
286
285
for ( let m in arr ) {
287
286
if ( ! Array . isArray ( arr [ m ] ) ) {
288
- Object . assign ( ans , arr [ m ] )
287
+ ans . push ( arr [ m ] ) ;
289
288
} else {
290
- flattenArray ( arr [ m ] , ans )
289
+ flattenArray ( arr [ m ] , ans ) ;
291
290
}
292
291
}
293
- return ans
292
+ return ans ;
294
293
}
295
294
296
295
297
296
/**
298
297
* the inverse process of tackleWithStyleObj
299
298
* @param str
300
299
*/
301
- export function flattenStyle ( str ) {
302
-
303
- if ( Array . isArray ( str ) ) {
304
- return flattenArray ( str )
300
+ export function flattenStyle ( fstyle ) {
301
+ let str = fstyle
302
+ if ( typeof fstyle !== 'string' ) {
303
+ // 可能是数组,可能是字符串,可能是其组合
304
+ str = tackleWithStyleObj ( fstyle )
305
305
}
306
306
307
- if ( typeof str === 'object' ) {
308
- return str
309
- }
310
307
311
308
const array = str . split ( ';' ) . filter ( i => i )
312
309
const obj = { }
You can’t perform that action at this time.
0 commit comments