frappe / cordova-wrapper

Mobile App Container (Cordova) for Frappé/ERPNext
MIT License
64 stars 97 forks source link

Can I call the function of the cordova plugin in doctype.js? #24

Closed Wjp43045 closed 5 years ago

Wjp43045 commented 5 years ago

This is a requirement that needs to be implemented on an Android phone. I need to use the abc.js function under Doctype to call the scan code plug-in function in cordova to scan the QR code. Is it feasible? Thank you.

Wjp43045 commented 5 years ago

I tested successfully. 1.frappe/public/js/frappe/desk.js +447 (example: redirect_to_login), Add "mobile_to_scanner: function() {},"

  1. The js file under Doctype: $("div[data-fieldname='scanner_btn']").on('click',function(){ var test = frappe.app.mobile_to_scanner(); console.log(test); }); 3.erpnext mobile app, mobile-master/www/js/desk.js +90 (eg: redirect_to_login) frappe.app.mobile_to_scanner = function() { //cordova code return "frappe.app.mobile_to_scanner"; }