Selaa lähdekoodia

Merge branch 'master' of http://git.ycjcjy.com/xiangsong/miniapp

张延森 4 vuotta sitten
vanhempi
commit
0eff47f439
1 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 11
    1
      src/utils/request.js

+ 11
- 1
src/utils/request.js Näytä tiedosto

5
 const accountInfo = Taro.getAccountInfoSync()
5
 const accountInfo = Taro.getAccountInfoSync()
6
 const appId = accountInfo.miniProgram.appId
6
 const appId = accountInfo.miniProgram.appId
7
 
7
 
8
+const entries = obj => {
9
+  const ownProps = Object.keys( obj )
10
+  let i = ownProps.length
11
+  const resArray = new Array(i)
12
+  while (i--)
13
+    resArray[i] = [ownProps[i], obj[ownProps[i]]]
14
+
15
+  return resArray
16
+}
17
+
8
 const query2String = query => {
18
 const query2String = query => {
9
-  return Object.entries(query || {}).map(pair => `${encodeURIComponent(pair[0])}=${encodeURIComponent(pair[1])}`).join('&')
19
+  return entries(query || {}).map(pair => `${encodeURIComponent(pair[0])}=${encodeURIComponent(pair[1])}`).join('&')
10
 }
20
 }
11
 
21
 
12
 const transPathArgs = (path, args) => {
22
 const transPathArgs = (path, args) => {