I am looking for a way to differentiate between the device and the simulator programmatically for Vodapay mini-programs, does anyone know of a way to do this?
Thank you
I am looking for a way to differentiate between the device and the simulator programmatically for Vodapay mini-programs, does anyone know of a way to do this?
Thank you
You can make use of process.env.NODE_ENV to achieve this. It returns 'development' when in the simulator and 'production' when on device.
if (process.env.NODE_ENV ==='development') {
//run this in simulator
console.log('simulator');
}
else{
// run this on device
console.log('device');
}