Vue handles the problem of Hyper App webview.evaluateJavascript callback handling

I just started VUE. I don"t know much about it. Please

problem description

in developing a small Internet of things project, Android needs to read MCU serial port data and send it back to WEB to deal with the, Hyper App front end is written in vue,

expected process

-[root] Android reads serial data and transfers serial data via evaluateJavascript callback javascript:onReceive method
-[root] hangs onReceive under window object through exprots.install
-[x] can receive webview return data
-[x] to a global response object and displays

in some components.
exports.install = function (Vue, options) {
    
    var data = { ///
    d1:0,
    d2:0,
    d3:0
    }
  window.onGameReceive = function (from, msg) {
    console.log(msg);
    parstData(msg);//
  };
 window.parstData(ss){
 var cmds = ss.split("|");
      data.d1 = cmds[1];
      data.d1= cmds[2];
      data.d1 = cmds[3];
  ....
}
< H2 > current problem < / H2 >
May.24,2021

vuex solution

Menu