Android and iOS intercept H5 Click events, this function event must be a burst in the window
Android and iOS intercept common H5 functions:
1 <div onclick = "show (), Window.android.show ()" ></div>2 <script>3 function Show () {
If you need to pass a value, you can add a parameter to the show and pass the value directly in the Click event above 4 alert (1)5 } 6 </script>
The Vue function does not leak directly under window, Vue's Click event is @click, so the above-mentioned app is blocked
Android and iOS intercept vue click events:
<div id= "box" @click = "show (' aaaa '), window.android.show (' aaaa ')" ></div>//in parentheses for the contents of the parameter, the first show is for iOS value, When clicked triggers the function defined in window, iOS intercepts the Zhi function directly, and Android can intercept the function defined in Vue directly <script src= "Vue.js" ></script> <script >functionZhi (a) {//define a burst to window function, placed in the Click event, the iOS intercept function is intercepted this burst to window functionConsole.log (a)}NewVue ({el:"#box", data:{}, methods:{show:function(a) {zhi (a); //A is a parameter that can be used to transmit values to iOS and AndroidAlert (1); } } })</script>
App embedded Vue h5, Android and iOS intercept H5 click events