Vue.js 在服务工作人员中使用vue存储
我在公用文件夹中有Vue.js 在服务工作人员中使用vue存储,vue.js,push-notification,vuex,Vue.js,Push Notification,Vuex,我在公用文件夹中有service worker push.js,在src文件夹中有registerservice worker.js。单击推送通知时,我希望将该数据保存在vue存储中,但出现错误无法在模块外部使用导入语句。是否有办法将推送通知数据保存到vue存储 import store from "./../src/store"; self.addEventListener("notificationclick", e => { store.commit("pushNotifica
service worker push.js
,在src文件夹中有registerservice worker.js
。单击推送通知时,我希望将该数据保存在vue存储中,但出现错误无法在模块外部使用导入语句。是否有办法将推送通知数据保存到vue存储
import store from "./../src/store";
self.addEventListener("notificationclick", e => {
store.commit("pushNotificationData", e.notification.data);
});
文件树
可能是
从“./src/store/main.js”导入存储
或者干脆
从“store/main.js”导入存储
它实际上取决于这个import
语句放在哪个文件中,
我不清楚你的问题