小编noo*_*gui的帖子

组件模板应该只包含一个根元素

组件模板应该只包含一个根元素.如果您在多个元素上使用v-if,请使用v-else-if来链接它们.

错误
./src/App.vue中无法编译并出现1个错误错误

(发出的值而不是错误的实例)错误编译模板:

 <div id="app" class="container">
     <div class="page-header">
        <h1>Vue.js 2 & Firebase Sample Application</h1>
     </div>
  </div class="panel panel-default">
     <div class="panel-heading">
         <h3>Book Lists</h3>
     </div>
     <div clas ="panel-body">
        <table class="table table-striped">
          <thead>
            <tr>
              <th>
                Title
              </th>
              <th>
                Author
              </th>
            </tr>
          </thead>
          <tbody>

          </tbody>
        </table>
     </div>
  </div>
Run Code Online (Sandbox Code Playgroud)

这是我的导出默认值

export default {
  name: 'app',
  firebase: {
    books: booksRef
  },
  components: {
    Hello
  }
}
Run Code Online (Sandbox Code Playgroud)

我应该修复哪个部分来删除错误?

javascript vue.js vuejs2

4
推荐指数
1
解决办法
3371
查看次数

如何在firebase set()中返回promise

如果将数据正确地推送到firebase或者如果被拒绝则捕获错误,我希望获得成功.我试过这样的代码:

db.push().set(todo).then(snap => {
      console.log(snap);

    });
Run Code Online (Sandbox Code Playgroud)

但SNAP,回调,是不明确的.我如何在这里使用承诺?

javascript firebase firebase-realtime-database

4
推荐指数
1
解决办法
3681
查看次数

在深度刷新Firebase之后反应生产路由器404

我的index.js中有这条路线

 <Router history={customHistory}>
        <div className="row">
            <Switch>
                <Route exact path="/login" component={Login}/>
                <Route path="/home" component={Home}/>
                <Route path="/politicas" component={Policies}/>

                <Redirect exact from="/" to="/login"/>
                <Route exact path="*" status={404} component={NotFound}/>

            </Switch>

        </div>
    </Router>
Run Code Online (Sandbox Code Playgroud)

在本地环境中总能正常工作,但是我有一个firebase应用程序,要部署我使用的firebase项目,我可以使用:

npm运行构建

火力基地部署

但是在firebase应用中,深度刷新返回404后,唯一可行的路由是“ /”,我该怎么做才能使路由始终与任何路径兼容?

firebase reactjs firebase-hosting

4
推荐指数
1
解决办法
1324
查看次数

Firebase Auth,电子邮件为Flutter

我目前正在努力实施电子邮件注册并登录我的应用程序.出于商业原因,我无法使用Google登录或其他替代方法.

如何在Flutter中使用电子邮件实施Firebase身份验证?有没有办法使用Firebase Auth插件?

email dart firebase firebase-authentication flutter

4
推荐指数
1
解决办法
2812
查看次数

使用NodeJS进行Firebase身份验证

到目前为止,我正在使用Mongodb和Express.我的整个身份验证是通过检查req.user对象完成的.从我看到的情况来看,Firebase身份验证主要在前端完成.如何req.user在后端使用Firebase?我看了几个教程,但他们只展示了几种方法并继续.我的意思是要更多地了解逻辑,但一些代码示例可能会有所帮助.

javascript node.js express firebase firebase-authentication

4
推荐指数
1
解决办法
5093
查看次数

FirebaseAnimatedList 实时更改内容

我想知道如何使用新查询、更改路径的新内容重建 FirebaseAnimatedList。

new Flexible(
              child: new FirebaseAnimatedList(
                  query: query,
                  sort: (DataSnapshot a, DataSnapshot b) =>
                      b.key.compareTo(a.key),
                  itemBuilder: (BuildContext context, DataSnapshot snapshot,
                      Animation<double> animation, int index) {...})
Run Code Online (Sandbox Code Playgroud)

当我实时更改查询时,它不会更改列表中的结果:

setState(() {
  query = "another/path";
});
Run Code Online (Sandbox Code Playgroud)

dart firebase firebase-realtime-database flutter

4
推荐指数
1
解决办法
1175
查看次数

JSONDecoder 无法处理空响应

语境

我正在使用Firebase 数据库 REST API和 JSONDecoder/JSONEncoder。到目前为止,它一直运行良好。但是,对于删除数据,预期返回的响应是null,而 JSONDecoder 似乎不太喜欢那样。

这是我通过 Postman 发送的查询类型以及我返回的内容(不包括敏感数据)。

DELETE /somedata/-LC03I3oHcLhQ/members/ZnWsJtrZ5UfFS6agajbL2hFlIfG2.json
content-type: application/json
cache-control: no-cache
postman-token: ab722e0e-98ed-aaaa-bbbb-123f64696123
user-agent: PostmanRuntime/7.2.0
accept: */*
host: someapp.firebaseio.com
accept-encoding: gzip, deflate
content-length: 39


HTTP/1.1 200
status: 200
server: nginx
date: Thu, 02 Aug 2018 21:53:27 GMT
content-type: application/json; charset=utf-8
content-length: 4
connection: keep-alive
access-control-allow-origin: *
cache-control: no-cache
strict-transport-security: max-age=31556926; includeSubDomains; preload

null
Run Code Online (Sandbox Code Playgroud)

如您所见,响应代码是200,正文是null

错误

当我收到响应时,这是我得到的错误:

Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data is not …

json firebase swift firebase-realtime-database decodable

4
推荐指数
2
解决办法
1927
查看次数

通知集频道和 FCM subscribeToTopic 有什么不同?

我的应用有一个会员系统(会员类型包括 A?B?C),我使用 FirebaseFCM向我的应用推送通知。

如果用户使用 A 登录,我将使用FirebaseMessaging.getInstance().subscribeToTopic("A");unsubscribeFromTopic("B"); unsubscribeFromTopic("C");

它工作得很好,直到我发现如果设备的 API >=26 我的应用程序通知将不会显示。原因是设置频道是最新 android 版本的重要更新。

我已经更改了我的通知代码,就像这样:

// For API >=26
NotificationManager mNotificationManager =
        (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    NotificationChannel channel = new NotificationChannel(
            "A",
            "A",
            NotificationManager.IMPORTANCE_HIGH);
    channel.setDescription("description");
    channel.enableLights(true);
    channel.enableVibration(true);

    Notification.Builder builder =
            new Notification.Builder(mContext)
                    .setSmallIcon(R.drawable.notification_icon)
                    .setContentTitle(title)
                    .setContentText(message)
                    .setChannelId("A");
    mNotificationManager.notify(1, builder.build());
}
Run Code Online (Sandbox Code Playgroud)

现在,如果FCM从 A 推送,我可以显示通知。

显然,如果我想从 B 或 C 获得,那么我应该设置通道 B 或 C。

但是成员类型 A 应该只能从 A 获取,所以我找到了官方文档Delete a notification channel

NotificationManager …
Run Code Online (Sandbox Code Playgroud)

android android-notifications firebase firebase-cloud-messaging

3
推荐指数
1
解决办法
1264
查看次数

Android Studio(3.1.4)渲染Design + Blueprint的问题

这是一个默认的入门项目.尚未编写新代码.图像说明了一切:

在此输入图像描述

Android SDK Manager: 在此输入图像描述

的build.gradle(模块:APP)

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "chatchattan.nooguiquirks.com.chatchattan"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0-rc01'
}
Run Code Online (Sandbox Code Playgroud)

我想我已经为此下载了必要的SDK(28).甚至尝试降级到API 24,25以查看它是否会发生任何变化,但设计和蓝图渲染预览不起作用.

尝试的解决方案:

  1. 确保您的Android SDK已更新为build.gradle的版本

  2. 清洁项目

  3. 无效缓存/重启

  4. 使用App主题

依然没有!

有什么好主意吗?:)

android android-layout android-studio

3
推荐指数
1
解决办法
4097
查看次数

我应该将Firebase API密钥隐藏到后端吗?不是由于数据安全,而是项目克隆问题

有人可以帮助我解决Firebase安全问题吗?
这是我试图弄清楚的:

我了解到,要让客户端与我的Firebase应用程序,配置进行交互, firebase.initializeApp(config)并将其公开,并且使用客户端的每个人都可以在浏览器开发人员控制台中看到它。

我也知道这很好,因为我可以使用安全规则和身份验证来保护数据。

但是,如果有人复制了我所有的客户端代码(包括配置)并构建了许多克隆站点,那么他们可以根据需要使用我的Firebase数据库了吗?

在这种情况下,我是否应该将configs(api键)隐藏到后端(如云函数)?谢谢...

api-key firebase firebase-realtime-database

3
推荐指数
2
解决办法
2260
查看次数