Javascript react json模式教程未显示在浏览器中
我对web开发(html/js)完全陌生,但现在想使用react json模式包,它在提供的沙箱中工作得非常好 然而,我甚至不能让教程工作。我已经编写了一个html,如教程中所示:Javascript react json模式教程未显示在浏览器中,javascript,html,reactjs,react-jsonschema-forms,Javascript,Html,Reactjs,React Jsonschema Forms,我对web开发(html/js)完全陌生,但现在想使用react json模式包,它在提供的沙箱中工作得非常好 然而,我甚至不能让教程工作。我已经编写了一个html,如教程中所示: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head&g
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app"></div>
<script type="text/jsx" src="react.js"></script>
</body>
</html>
请尝试以下内容:
import Form from 'react-jsonschema-form';
class Index extends DataComponent{
constructor(props){
super(props);
this.state={
schema: {
type: 'object',
title: 'Info',
properties: {
task: {
type: 'string',
title: 'First Name'
}
}
}
}
}
render(){
return(
<Form
schema={this.state.schema}
/>
)
}
}
从“react jsonschema表单”导入表单;
类索引扩展了DataComponent{
建造师(道具){
超级(道具);
这个州={
模式:{
类型:“对象”,
标题:“信息”,
特性:{
任务:{
键入:“字符串”,
标题:“名字”
}
}
}
}
}
render(){
返回(
)
}
}
尝试以下操作:
import Form from 'react-jsonschema-form';
class Index extends DataComponent{
constructor(props){
super(props);
this.state={
schema: {
type: 'object',
title: 'Info',
properties: {
task: {
type: 'string',
title: 'First Name'
}
}
}
}
}
render(){
return(
<Form
schema={this.state.schema}
/>
)
}
}
从“react jsonschema表单”导入表单;
类索引扩展了DataComponent{
建造师(道具){
超级(道具);
这个州={
模式:{
类型:“对象”,
标题:“信息”,
特性:{
任务:{
键入:“字符串”,
标题:“名字”
}
}
}
}
}
render(){
返回(
)
}
}
如果已安装库,请删除
//const Form=JSONSchemaForm.default 如果已安装库,请删除
//const Form=JSONSchemaForm.default 即使我将其粘贴到html中的a中,它仍然不会显示任何内容。IDE告诉我for constructor():错过了超类的构造函数调用它仍然不会显示任何内容,即使我将其粘贴到html中的。IDE告诉我构造函数():错过了超类的构造函数调用
import react from React
import import ReactDOM from 'react-dom'
import Form from "@rjsf/core";
import Form from 'react-jsonschema-form';
class Index extends DataComponent{
constructor(props){
super(props);
this.state={
schema: {
type: 'object',
title: 'Info',
properties: {
task: {
type: 'string',
title: 'First Name'
}
}
}
}
}
render(){
return(
<Form
schema={this.state.schema}
/>
)
}
}