小编qui*_* 的帖子

FirebaseMessaging.onBackgroundMessage 不起作用

FirebaseMessaging.onBackgroundMessage不起作用。我遵循了官方文档。我使用的版本:firebase_messaging: ^14.2.1

@pragma('vm:entry-point')
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  print("Handling a background message: ${message.messageId}");
}

void main() async {
  await Firebase.initializeApp()
  FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
}
Run Code Online (Sandbox Code Playgroud)

这是我通过云函数发送 fcn 的方式:

admin.messaging().sendMulticast({
        tokens: [user.fcmToken!],
        apns: {
          payload: {
            aps: {
              "mutable-content": 1,
              "content-available": 1,
            },
          },
        },
        notification: {
          body: body,
          title: title,
        },
        data: {
          hello: "world?!",
        },
      });
Run Code Online (Sandbox Code Playgroud)

我可以看到推送通知在我的设备上弹出,但FirebaseMessaging.onBackgroundMessage没有被调用。有什么想法可能是问题出在哪里吗?

firebase flutter firebase-cloud-messaging

7
推荐指数
1
解决办法
1923
查看次数

为什么我的 node_modules 文件夹在执行“npm install”命令后变灰?

我想知道为什么我的 node_modules 文件夹在我运行命令后在我的 VS Code 编辑器中显示为灰色npm install

这是我文件夹的图片:

在此处输入图片说明

visual-studio-code

6
推荐指数
3
解决办法
8024
查看次数

读取 firestore 中的子集合

如何读取 firestore 中的子集合?

db.collection('users')
  .doc('5mmwJba8FVMrdHGOPBYraOQzDe22')
  .collection('restaurants').get().then(function(doc) {
    if (doc.exists) {
      console.log("Document data:", doc.data());
    } else {
      console.log("No such document!");
    }
  }).catch(function(error) {
    console.log("Error getting document:", error);
  });
Run Code Online (Sandbox Code Playgroud)

路径是:/users/5mmwJba8FVMrdHGOPBYraOQzDe22/restaurants/qZg6gkOvYHOPXHDJAqBF

javascript firebase google-cloud-firestore

2
推荐指数
1
解决办法
2266
查看次数

按索引过滤对象数组

我想按索引过滤对象数组。

<ul>
    <li v-for="(list,index) in lists" v-bind:key="index"
    @dblclick="deleteNote(index)">
    {{list.note}    
    </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

列表中充满了以下对象imp

var lists = [];

var imp = {
  note: "bla",
  hinweis: "blub",
  showNotiz: false
};

deleteNote(i) {
  let arr = this.lists.filter(item =>
    item.note !== this.lists[i]
  );

  this.lists = arr;
}
Run Code Online (Sandbox Code Playgroud)

html javascript vue.js

0
推荐指数
1
解决办法
1万
查看次数

将英雄动画与 GetX Flutter 结合使用

有人有使用 GetX 路线管理中的英雄动画的经验吗?我按照https://docs.flutter.dev/development/ui/animations/hero-animations中的说明进行操作,并用于Get.toNamed()在我的路线之间导航,但它不起作用。

flutter flutter-animation flutter-getx

0
推荐指数
1
解决办法
873
查看次数