Reputation: 4167
For example the following code:
<div id="app">
<wv></wv>
</div>
<script>
if (inCrm()) {
Vue.component("wv", {
template: `<iframe></iframe>`
})
} else if (inElectron()) {
Vue.component("wv", {
template: `<webview></webview>`
})
}
new Vue({el: "#app"})
</script>
I hope to debug in chrome and run in electron, how to distinguish between the two at runtime?
Upvotes: 1
Views: 100
Reputation: 4167
I find the solution in here
use following code:
window && window.process && window.process.type
Upvotes: 1