我正在创建一个 dom 模块来在 div 中显示我的 firebase 数据。我在https://www.youtube.com/watch?v=9AHDSGitDP0&t=639s上观看了 Polycast 视频,但 firebase-query 组件没有提取数据。除了我登录的用户数据之外,控制台中没有显示任何数据,并且没有错误。我看到其他人在使用 polymerfire 提取数据时遇到问题,我在这里尝试了解决方案,但没有运气:Polymer + Firebase (Polymerfire): <firebase-query> not working inside single page app view (with <firebase-app> 位于我的应用程序.html)
有人可以帮忙吗?
在我的主要 html 页面中,我有以下内容:
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="stylesheets/style.css">
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/polymerfire/polymerfire.html">
<link rel="import" href="../bower_components/polymerfire/firebase-app.html">
<link rel="import" href="../bower_components/polymerfire/firebase-database-script.html">
<link rel="import" href="../bower_components/webcomponentsjs/webcomponents-lite.js">
<link rel="import" href="elements/browse-events.html"> <!-- my custom component -->
</head>
<body>
<firebase-app
api-key=""
auth-domain=""
database-url=""
project-id=""
storage-bucket=""
messaging-sender-id="">
</firebase-app>
<!-- my custom component -->
<browse-events></browse-events>
</body>
这是我的组件文件(browse-events.html)中的代码
<!-- dependencies -->
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/polymerfire/polymerfire.html">
<link rel="import" href="../bower_components/polymerfire/firebase-app.html">
<link rel="import" href="../bower_components/polymerfire/firebase-database-script.html">
<link rel="import" href="../bower_components/polymerfire/firebase-database-behavior.html">
<link rel="import" href="../bower_components/polymerfire/firebase-query.html">
<dom-module id="browse-events">
<template>
<firebase-query
id="query-all"
app-name="authtest-54513"
path="/events"
data="{{events}}">
</firebase-query>
<template is="dom-repeat" items="[[events]]" as="event">
<div>
<h1>[[event.title]]</h1>
</div>
</template>
</template>
<script>
Polymer({
is:'browse-events',
properties: {
events: {
type: Object
}
}
});
</script>
</dom-module>