Comments (2)
@anti996sz 是不是直接调用的tcb.auth()
?如下
import tcb from 'tcb-js-sdk';
const app = tcb.init({
// ...
});
const auth = tcb.auth();
// 获取登录态
console.log(auth.getLoginState());
虽然这样不会报错,但是建议调用app.auth()
而不是tcb.auth()
。
tcb可以创建多个app分别对应不同的环境id,每个app都是一个封闭的命名空间,互相之间的状态不共享。所以上述代码在调用tcb.auth()
后实际上与前面的app属于不同的命名空间。所以上述代码更正后如下:
import tcb from 'tcb-js-sdk';
const app = tcb.init({
// ...
});
const auth = app.auth();
// 获取登录态
console.log(auth.getLoginState());
from tcb-js-sdk.
问题没有确定就关掉了?问题并是像楼上所述,实际情况是使用 tcb + vue.js 来开发,tcb实例全局实例化一次,后面各个页面只是使用tcb实例化后的全局的变量而已,各个页面也不会创建新的tcb实例,所以不存在刷新页面创建新的实例,不是楼上所说的情形。
from tcb-js-sdk.
Related Issues (19)
- 授权登陆返回错误 HOT 2
- 如何在react-native中调用 HOT 7
- upload文件时无法中止request HOT 1
- tcb-js-sdk 与 nuxt.js框架不兼容
- nuxt上报window is not defined HOT 6
- 数据库集合的权限使用“自定义权限”时出错 HOT 1
- 数据库 doc(id).get() 获取到的是一个数组 HOT 1
- 匿名登录失败 [100004] Env do not have datakey
- 自定义登录报错 {"code":"SYS_ERR","message":"非法的sign"} HOT 1
- 判断登陆状态是否过期的方法 HOT 1
- callFunction 方法的入参,文档里写的和 .d.ts 文件里写的不一致 HOT 2
- 在微信小游戏中可以直接使用tcb的接口weixinAuthProvider进行微信授权登陆吗? HOT 1
- 1.7.0版本以及之后,有人遇到CocosCreater2.4微信小游戏真机调试TypeError: Function(...) is not a function么? HOT 1
- 希望提供Dart版sdk HOT 3
- Vue Typescript 工程引用报错 HOT 4
- 网页刷新后如何维持登录态 HOT 3
- Nativescript: Can't find variable: window HOT 2
- uploadFile不会触发onUploadProgress, 无法追踪上传进度
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tcb-js-sdk.