electron如何判断当前操作系统是windows还是mac

electron判断当前操作系统是windows还是mac,可以用node.js中的process.platform来判断

if(process.platform == 'darwin'){
     console.log('这是mac系统');
}
if(process.platform == 'win32'){
     console.log('这是windows系统');
}
if(process.platform == 'linux'){
     console.log('这是linux系统');
}

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: