小编Rad*_*gus的帖子

创建应用程序时出现本机错误“无法使用 BuildScopeServices.createScriptPluginFactory() 创建 ScriptPluginFactory 类型的服务。”

我试着做

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)

react-native

8
推荐指数
2
解决办法
6435
查看次数

(CKEditor) 窗口未定义 ReactJS 在实现时

我想在我的反应项目中实现 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)

ckeditor reactjs

5
推荐指数
1
解决办法
3797
查看次数

useRouter 在 getInitialProps 中不起作用

我正在尝试使用 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)

reactjs

2
推荐指数
1
解决办法
2144
查看次数

将Draft JS实现到Next JS中,文本编辑器不会显示

我正在尝试将草案 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)

reactjs next.js

2
推荐指数
1
解决办法
2457
查看次数

标签 统计

reactjs ×3

ckeditor ×1

next.js ×1

react-native ×1