在那里,我得到以下行的ESlint错误 this.state.items.map(item => (
错误是 Must use destructuring state assignment
{
this.state.items.map(item => (
<div key={item}>
{
item.links.map(thing => (
<NavLink
key={thing.link.id}
exact
to={thing.link.url}
>
{thing.link.text}
</NavLink>
))
}
</div>
))
}
Run Code Online (Sandbox Code Playgroud)
使用"eslint-config-airbnb"
如果这是相关的,这也是我的componentDidMount函数
componentDidMount() {
fetch('./data/data_arr.js')
.then(results => results.json())
.then(results => this.setState({ items: results }));
}
Run Code Online (Sandbox Code Playgroud)
任何尝试和理解这一点的帮助都会很棒.谢谢
pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- The Bad Boy -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId> …Run Code Online (Sandbox Code Playgroud) 我输入了数学.
import 'dart:math';
Run Code Online (Sandbox Code Playgroud)
但是我怎么称呼"PI"不变?
这不起作用.
math.pi / 12.0
Run Code Online (Sandbox Code Playgroud) 我有一个移动应用程序(react-native)、一个资源服务(spring boot)和 Keycloak Authenticatioin Service(Auth-Service)。
客户端直接使用 Auth-Service 进行身份验证并获取访问令牌。当我向资源服务发出请求时,资源服务通过询问 Auth-Service 来检查访问令牌。但是客户端应用程序和 iss 字段获取的令牌是http://10.0.2.2:8060/auth/realms/sau和我在http://localhost:8110 的资源服务。
Keycloak 说: error="invalid_token", error_description="Invalid token issuer. Expected 'http://localhost:8060/auth/realms/sau', but was 'http://10.0.2.2:8060/auth/realms/sau'"
我的问题是如何代表我的客户在资源服务中进行身份验证?
移动应用:
export const prepareRequestBody = credentials => {
const params = new URLSearchParams();
params.append('username', credentials.username);
params.append('password', credentials.password);
params.append('client_id', "nasilim-mobile-app");
params.append('grant_type', "password");
return params;
};
export const login = credentials => {
const params = prepareRequestBody(credentials);
return axios.post(LOGIN, params);
};
Run Code Online (Sandbox Code Playgroud)
资源服务:
应用程序.yml
keycloak:
realm: sau
resource: photo-service
bearer-only: false
auth-server-url: http://localhost:8060/auth
credentials: …Run Code Online (Sandbox Code Playgroud) oauth-2.0 openid-connect keycloak keycloak-services keycloak-rest-api
我有一个对象,我想将此对象的简化版本发送到服务器.
{
"fullName": "Don Corleone",
"actor": {
"actorId": 2,
"name": "Marlon",
"surname": "Brando",
"description": "Marlon Brando is widely considered the greatest movie actor of all time... ",
"heroList": [],
"photo": "C:\\projects\\files\\actor\\1532955376934.png"
},
"heroProfilePhoto": "data:image/png;base64,/9j/...
"production": {
"title": "The Godfather",
"imdbRate": 9.2,
"genre": "8",
"releaseDate": "1972-03-23T21:00:00.000Z",
"director": "Francis Ford Coppola",
"writer": "Mari Puzo",
"detail": "The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son."
}
}"
Run Code Online (Sandbox Code Playgroud)
我有两个问题::
1)是否有可能提取像这样用替代品参数的JSON.stringify() ?
{ …Run Code Online (Sandbox Code Playgroud) 我正在开发一个 chrome 扩展,我有一个“ background.js”,它可以过滤 url 并从我的 api 获取数据。当条件满足时,我会从“ ”发送消息background.js。我想从 捕获它Angular component。
背景.js
...
chrome.pageAction.show(tab.id, () => {
chrome.runtime.sendMessage({data: dataFromAPI})
});
...
Run Code Online (Sandbox Code Playgroud)
我跑了npm install --save @types/chrome。
应用程序组件.ts
import {Component} from '@angular/core';
import {chrome} from '@types/chrome';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor() {
chrome.runtime.onMessage.addListener( data => console.log(data));
}
}
Run Code Online (Sandbox Code Playgroud)
但 WebStorm 说,“ .../node_modules/@types/chrome/index.d.ts' is not a module.”
如何使用 Angular 组件中的 Chrome Api?
如果用户将某些内容复制到剪贴板,我想得到通知。
我创建了一个服务并在 HomeActivity 中启动它,我还编写了一个计时器来检查我的服务是否正常工作。我检查过,我的服务正在运行 Log cat 显示了这一点。但是我的监听器方法不起作用,我在这里缺少什么?
剪贴板观察者服务:
public class ClipBoardWatcherService extends Service {
private final String tag = "FameThings";
private ClipboardManager.OnPrimaryClipChangedListener listener = new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public void onPrimaryClipChanged() {
performClipBoardCheck();
}
};
public static void start(Context context) {
Intent i = new Intent(context, ClipBoardWatcherService.class);
context.startService(i);
}
@Override
public void onCreate() {
((ClipboardManager) getSystemService(CLIPBOARD_SERVICE)).addPrimaryClipChangedListener(this.listener);
new Timer().scheduleAtFixedRate(new TimerTask(){
@Override
public void run(){
Log.i("tag", "A Kiss every 5 seconds");
}
},0,5000);
}
@Override
public int onStartCommand(Intent intent, int flags, int …Run Code Online (Sandbox Code Playgroud) 我正在使用嵌套导航。据我所知,根导航器是 aStackNavigator并且 child 是DrawerNavigator无法通过 放置标题栏的DrawerNavigator。所以我通过做到了StackNavigator这一点,但当我导航DrawerNavigator. 如何更新标题标题DrawerScreen
根导航器:
<Stack.Navigator screenOptions={screenOptions} initialRouteName="Login">
<Stack.Screen name="Login" component={Login} />
// ...
<Stack.Screen // This is the screen that contains a child navigator
name="Main"
component={Main}
options={({navigation}) => ({
title: 'Main Page',
headerLeft: () => <MenuIcon stackNavigation={navigation} />,
})}
/>
</Stack.Navigator>
Run Code Online (Sandbox Code Playgroud)
儿童导航器:
<Drawer.Navigator>
//...
<Drawer.Screen
name="Bids"
component={Bids}
options={{
title: text.bids, // This updates the title that in the drawer navigator menu not the header …Run Code Online (Sandbox Code Playgroud) react-native react-navigation react-navigation-drawer react-navigation-stack react-navigation-v5
这个页面iframe上有一个我想从标签中获取屏幕截图,所以我必须到达标签中的视频标签。videoiframe
当我打开控制台并运行此代码时:
const videoElement = document.getElementsByTagName('iframe')[0]
.contentWindow.document.getElementsByTagName('video')[0];
//Extracting picture from video tag
const canvas = document.createElement('canvas');
canvas.width = videoElement.videoWidth;
canvas.height = videoElement.videoHeight;
canvas.getContext('2d').drawImage(videoElement, 0, 0, canvas.width, canvas.height);
Run Code Online (Sandbox Code Playgroud)
已抛出此错误:
Uncaught DOMException: Blocked a frame with origin "https://developers.google.com" from accessing a cross-origin frame.
at <anonymous>:1:57
Run Code Online (Sandbox Code Playgroud)
另外,我检查了这个问题
我的问题是如何从 YouTube Player API 获取屏幕截图?
javascript iframe youtube-api youtube-javascript-api youtube-iframe-api
我在文档中找不到@{}vs之间的区别
。@={}
有什么不同?
我想实现ViewBinding作为Android Studio中描述的文件中。
但是我得到以下错误:
错误:在类型为com.android.build.gradle.internal.dsl.BaseAppModuleExtension的对象上找不到参数[build_86jkemkg0wj9ybuijdbbuahly $ _run_closure1 $ _closure5 @ 2714f9c5]的方法viewBinding()。
我拥有适用于Linux的最新版本的Android Studio。
为什么我出现错误?
android ×3
javascript ×3
dart ×2
flutter ×2
typescript ×2
angular ×1
clipboard ×1
eslint ×1
iframe ×1
keycloak ×1
oauth-2.0 ×1
react-native ×1
reactjs ×1
spring-boot ×1
swagger-2.0 ×1
youtube-api ×1