我正在为应用程序使用Ionic Capacitor和Framework7。我想使用电容器本地通知插件来实现本地通知。但是,它给了我未捕获的referenceError:未定义LocalNotifications

//Importing plugin
import  {Plugins}  from '../node_modules/@capacitor/core';
const  {LocalNotifications}  = Plugins;

//Schedule Local Notifcations
LocalNotifications.schedule({
        notifications: [{
            title: "Title",
            body: "Body",
            id: 1,
            schedule: {
                at: new Date(Date.now() + 1000 * 5)
            },
            sound: 'res://audio/android/iphone_6.mp3',
            attachments: null,
            actionTypeId: "",
            extra: null
        }]
    });


未捕获的ReferenceError:未定义LocalNotifications

最佳答案

尝试像Plugins那样导入import { Plugins } from '@capacitor/core';

09-20 00:24