VUE Js Cordova, навигатор.device не определен - PullRequest
1 голос
/ 28 октября 2019

Я пытаюсь реализовать аудиозапись с помощью cordova-plugin-media-capture в VueJs Cli 3, Mean Пока я сталкиваюсь с navigator.device не определен. Другие функции, такие как navigator.vibration и navigator.camera, работают нормально. Пробовал свсе обходные пути на разных форумах до сих пор не удаются, ваши ценные входные данные приветствуются

Включили cordova.js в index.html и установили плагин для устройства, все еще бесполезный.

Main.ts

Vue.config.productionTip = false
const init = () => {
new Vue({
 router,
 store,
 vuetify,
 render: h => h(App)
}).$mount('#app')
}

declare let navigator : any;
declare let device : any;
document.addEventListener("deviceready", () => {
 init();
 console.log(navigator.device);
 console.log("Ready, Render the App");
});


// If we are not in Cordova, manually trigger the deviceready event
const isCordovaApp = false;
if (!isCordovaApp){
 document.dispatchEvent(new CustomEvent("deviceready", {}));
}

Cordova Config.xml

 <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <plugin name="cordova-plugin-device" spec="^2.0.3" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
...