Ionic 3 Native - LinkedIn 登录错误
Ionic 3 Native - LinkedIn login error
我在 Ionic 3 应用程序中使用了 ionic native linkedin 插件。
我的代码:
var scopes = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
this.linkedin.login(scopes, true).then((res) => {
console.log(res) ;
}, (err) => {
console.log(err) ;
});
我有错误:
Argument of type 'string[]' is not assignable to parameter of type
'LinkedInLoginScopes[]'. Type 'string' is not assignable to type
'LinkedInLoginScopes'.
请帮帮我。
您需要定义scopes
的类型。
插件包装器中 scopes
参数的类型-
export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress'
| 'rw_company_admin' | 'w_share';
login(scopes: LinkedInLoginScopes[], promptToInstall: boolean):
Promise { return; }
let scopes:any = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
或
let scopes:Array<string> = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
this.linkedin.login(scopes, true).then((res) => {
console.log(res) ;
}, (err) => {
console.log(err) ;
});
定义如下:
scopes: LinkedInLoginScopes[] = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
我在 Ionic 3 应用程序中使用了 ionic native linkedin 插件。
我的代码:
var scopes = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
this.linkedin.login(scopes, true).then((res) => {
console.log(res) ;
}, (err) => {
console.log(err) ;
});
我有错误:
Argument of type 'string[]' is not assignable to parameter of type 'LinkedInLoginScopes[]'. Type 'string' is not assignable to type 'LinkedInLoginScopes'.
请帮帮我。
您需要定义scopes
的类型。
插件包装器中 scopes
参数的类型-
export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_company_admin' | 'w_share';
login(scopes: LinkedInLoginScopes[], promptToInstall: boolean): Promise { return; }
let scopes:any = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
或
let scopes:Array<string> = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
this.linkedin.login(scopes, true).then((res) => {
console.log(res) ;
}, (err) => {
console.log(err) ;
});
定义如下:
scopes: LinkedInLoginScopes[] = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];