If I write bad code, please punish me by law, not by…
The scenario is as follows: a company project uses uniApp to develop a pin applet. One of the applications is to load an H5 page in web-view. The H5 page has a button that returns to the previous page of the pin applet when clicked. Feel very simple, pick up the nail developer document or uniApp development document and use CV method can be completed, nail development document about this part of the connection:Nail developer documentation H5 uses the dd. PostMessage method to send the message
Attach my code
```js
<web-view onMessage="onmessage" @click="test" id="web-view-1" :src="webUrl"></web-view>
```
Copy the code
But…
The message is triggered, but the function can not find what is the ghost?
After browsing the Internet, many people have encountered the same problem, and there is no solution posted below.
After losing a few hairs, he fell asleep and tried everything he could think ofThen I ran it and it worked!!
Finally ruled out the following correct code:
<web-view @message="onmessage" id="web-view-1" :src="webUrl"></web-view>
Copy the code
I was going to write @onMessage, but I fell asleep and wrote @message, but it triggered the correct mechanism.
If I am guilty, please let the law punish me, not the compatibility bug punish my hair…