Giter Club home page Giter Club logo

Comments (2)

zhoujunpeng avatar zhoujunpeng commented on June 8, 2024

@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.

scottwansz avatar scottwansz commented on June 8, 2024

问题没有确定就关掉了?问题并是像楼上所述,实际情况是使用 tcb + vue.js 来开发,tcb实例全局实例化一次,后面各个页面只是使用tcb实例化后的全局的变量而已,各个页面也不会创建新的tcb实例,所以不存在刷新页面创建新的实例,不是楼上所说的情形。

from tcb-js-sdk.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.