Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 电容器/离子/Vue本地通知eventlistener_Vue.js_Ionic Framework_Event Handling_Capacitor_Localnotification - Fatal编程技术网

Vue.js 电容器/离子/Vue本地通知eventlistener

Vue.js 电容器/离子/Vue本地通知eventlistener,vue.js,ionic-framework,event-handling,capacitor,localnotification,Vue.js,Ionic Framework,Event Handling,Capacitor,Localnotification,我正在尝试让本地通知在Ionic Vue应用程序中工作(使用电容器) 我确实得到了安排通知的工作,但现在我想听听对通知的点击 在main.js中,我将LocalNotifications绑定到它。$LocalNotifications: import { Plugins } from '@capacitor/core'; const { LocalNotifications } = Plugins; Vue.prototype.$LocalNotifications = LocalNotifi

我正在尝试让本地通知在Ionic Vue应用程序中工作(使用电容器)

我确实得到了安排通知的工作,但现在我想听听对通知的点击

在main.js中,我将LocalNotifications绑定到它。$LocalNotifications:

import { Plugins } from '@capacitor/core';
const { LocalNotifications } = Plugins;

Vue.prototype.$LocalNotifications = LocalNotifications;
在我的根组件应用程序中,我有:

created() {
console.log('Created!')
document.addEventListener('deviceready', () => {
      console.log('ready');
       this.$LocalNotifications.addListener('localNotificationReceived', (notification) => {
          console.log('Notification action received', notification);
        });
    }, false);
}
在ios emulator上构建和运行时,我在日志中获得以下输出:

APP ACTIVE
To Native Cordova ->  Badge load Badge1248600129 ["options": []]
⚡️  [log] - onscript loading complete
To Native Cordova ->  Device getDeviceInfo Device1248600130 ["options": []]
⚡️  To Native ->  Storage get 90127150
⚡️  TO JS {"value":null}
⚡️  [log] - Created!
To Native Cordova ->  LocalNotification launch LocalNotification1248600131 ["options": []]
To Native Cordova ->  LocalNotification ready INVALID ["options": []]
⚡️  To Native ->  LocalNotifications addListener ⚡️  [log] - ready
90127151
⚡️  WebView loaded
⚡️  To Native ->  App addListener 90127152
当我安排通知时,通知确实会出现,但我认为在添加侦听器时,有些事情进展不太顺利:

INVALID ["options":[]]
有人知道如何解决这个问题吗? 或者是否有人有在Ionic Vue应用程序中运行通知的代码示例

亲切问候,

布拉姆