0
如果我有一个使用聚合力的firebase身份验证元素,在全局范围内使用用户属性,最佳方式是什么?全局使用Polymerfire身份验证
举例来说,如果我有一个登录按钮元素:我要显示或隐藏许多组件这样
<dom-module id="tab-b">
<template>
<style>
</style>
<firebase-app auth-domain="example.firebaseapp.com"
database-url="example.firebaseio.com/"
api-key="">
</firebase-app>
<firebase-auth id="auth" location="{{location}}" user="{{user}}"provider="google" on-error="handleError">
</firebase-auth>
<paper-button id="googSignIn" class$="signInButton {{_getMiniClass()}}"on-tap="login" raised>
Google
</paper-button>
</template>
<script>
(function() {
'use strict';
Polymer({
is: 'tab-b',
properties:{
user: {
type: Object
},
statusKnown: {
type: Object
}
},
login: function(){
return this.$.auth.signInWithPopup();
},
logout: function(){
return this.$.auth.signOut();
}
});
})();
</script>
</dom-module>
然后:
<element show$={{!user}}><element>
你可以只添加'火力点,auth'元素任何你需要的值:'<火力-auth用户= “{{用户}}” >火力-AUTH>' –