Jump applet Hong eighty-one pit of mass participation

Dying disease in shock and sat up, smiled and asked where to Bug? !

1, first capital letter mischief

Two days before the release of "qi message" new version v2.0.0, you know the result ... Well, no Bug program is not a good program, write Bug is not a good programmer programmers.

That, there are one or two small Bug normal friends.

User feedback has received a notification message reply, but did not point into the content. Bug how will it? The method you use is definitely wrong.

I come home immediately open the Developer Tools, a test found that, sure enough, I could not write the Bug.

Is an expert in writing Bug, Bug I was not bad looking, and finally locate the reason: The parameter is not properly passed.

 

A 页面
// a.wxml
<view data-testID="test" data-openid="msunh" bindtap="toB">B</view>

// a.js
toB(e) {
  var i = e.currentTarget.dataset;
  wx.navigateTo({
    url: '/pages/b?testID=' + i.testID + '&openid=' + i.openid,
  })
  console.log(i)
}
B 页面
// b.js
onLoad: function (options) {
  this.setData({
    testID: options.testID,
    openid: options.openid
  })
}

The results are:

Obviously, openid get the correct parameters, indicating receiving and transfer process hair problem, that is, before passing on the wrong testID.

Console print of your dataset, found no, testID became testid.

This shows what? That he engaged in something, he engaged me! Here the testID into testid, will be able to properly passed.

Data binding can not be capitalized, remember ah, brother die. (Or you can bind uppercase, lowercase acquisition, happy to okay)

2, even one? I dare to do?

Bug thinking can change the rest will be finished, the results of the night and was looking for: Re readers failed.

I tried it, did not find the problem, he said. I replied: refresh? Try more than twice? Another network? I should not be here all right ...

After a while, my brother said this does not work, then the middle of the night also my brother and I came to the Bug, moved, find Bug I specifically made a red envelopes thanks.

Finally, a question mark, where the data was found disconnected, before the data is normal, after the data is truncated. Closer look because the user has entered an English " ? "? ? ? ? ? ?

To be a test:

 

A page
 // a.wxml 
<View the Data-the Hello = "how are you recently? I'm fine," bindtap = "Tob"> Tob </ View> // a.js Tob (E) {
   var i = e.currentTarget .dataset; 
  wx.navigateTo ({ 
    URL: '? / pages / B = Hello' + i.hello, 
  }) 
} 
B page // b.js 
the onLoad: function (Options) {
   the this .setData ({ 
    Hello: Options. Hello, 
  }) 
}


AppData result is this:

It really is a question mark for the trouble, skull pain, even a " ? " Are looking for a fight, I'm so南南南南南South ah.


3, disk him

Found a problem on his plate, but can not blame the user, ghosts know when to enter a " ? ." Because the jump path parameters are also used in Canada, " ? ", So there should be mistaken " ? " Back with parameters.

Finally, I think the two approaches, here for your reference, if there is a better way, welcome to discuss the message.

I. jump page when the  dataset  of data written to the cache, and then read to the new page cache, there is not long-winded, the key is the second.

II. Use  replace  the? Transformed into?

But there is a problem with   replace ( '?', '? ')  , It can only be translated once.

If you enter more than one question mark it? Do not rule out this possibility, it is not recommended to use   the replace ( '?', '?')  , Recommend regular expressions added that  the replace (/ \? / G, "? ")  To the conversion of a question mark.

 

4, finally

Nine qi qi pack abs back, not updated for some time, he has been busy rewriting small program, mainly because I have not think of a better excuse.

This year there are 101 days, I will try to climb to update, click on the bottom "write message" to discuss it, share, and discuss is the better way to learn, shake it up.

This article first appeared in public numbers, "I am the Jiu Qi", take a step on pit it!

Guess you like

Origin www.cnblogs.com/msunh/p/11566615.html