我试着做
react-native run-android
Run Code Online (Sandbox Code Playgroud)
但是它出现了错误
--------------
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Could not install the app on the …Run Code Online (Sandbox Code Playgroud) 我想在我的反应项目中实现 CKEditor。但是,我在尝试加载它时收到一个错误。我一直在关注所有官方文档。我不知道为什么,无论如何这是我的代码
import React from 'react';
class MyEditor extends React.Component {
state = {loading: true};
componentDidMount() {
this.CKEditor = require("@ckeditor/ckeditor5-react");
this.ClassicEditor = require("@ckeditor/ckeditor5-build-classic");
this.setState({ loading: false });
}
render() {
return ({this.CKEditor && (<this.CKEditor editor={this.ClassicEditor} data="<p>Hello from CKEditor 5!</p>"
onInit={ editor => {
// You can store the "editor" and use when it is needed.
console.log( 'Editor is ready to use!', editor );
} }
onChange={ ( event, editor ) => {
const data = editor.getData();
console.log( { event, editor, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 POST 方法从 API 获取数据,但是,我正在努力将数据设置为 post
import { useRouter } from 'next/router';
import Layout from '../../components/MyLayout';
import Settings from '../../components/Settings';
const Post = props =>{
//works if I use here
const router = useRouter();
return (
<Layout>
<h1>{router.query.id}</h1>
<p>This is the blog post content.</p>
</Layout>
);
}
export default Post;
Post.getInitialProps = async function(){
//trying to get data ($_GET)
const router = useRouter();
const data = router.query;
//
const FormData = new URLSearchParams();
const res = await fetch(Settings.api+'viewPost',{
method: 'POST', …Run Code Online (Sandbox Code Playgroud) 我正在尝试将草案 js 作为文本编辑器实现到我的 next.js 项目中。我已经根据官方指南实现了所有代码,但文本编辑器不会显示。这是我的代码
索引.js
import React, { Component } from 'react'
import { useRouter, Router } from 'next/router';
import Layout from '../../components/MyLayout';
import Settings from '../../components/Settings';
import MyEditor from '../../components/TextEditor';
import fetch from 'isomorphic-unfetch';
import {Editor, EditorState} from 'draft-js';
const Post = (props) => {
const router = useRouter();
const object = props.post.data[0];
return (
<Layout>
<h1>{object.title}</h1>
<div className="p-2 border bg-light text-right text-dark">Oleh: {object.username}</div>
<MyEditor/>
</Layout>
);
}
Post.getInitialProps = async function(context) {
const {id} = context.query;
const …Run Code Online (Sandbox Code Playgroud)