我正在使用react-awesome-query-builder来构建查询和搜索。当我再次登录应用程序时,我想在同一搜索中显示之前输入的查询。我的意思是一些默认选择的标准。我用谷歌搜索了一种实现方法,但不幸的是我不明白。下面是代码
class QueryProcessor extends Component{
constructor(props){
super(props);
this.state={
query:null,
}
this.getChildren=this.getChildren.bind(this);
let query=null;
let mainDate=null;
}
getChildren(props) {
this.query=QbUtils.queryString(props.tree, props.config);
return (
<div>
<div className="query-builder">
<Builder {...props} />
</div>
</div>
)
}
onChange(tree) {
//here you can save tree object:
// var treeJSON = transit.toJSON(tree);
console.log("tree",tree);
}
render(){
let mainData=this.props.rulingList?this.props.rulingList:null;
console.log("mainData",mainData);
return(
<div className="page-content container-fluid header-master">
<div className="content content-background">
<div className="col-md-12 custom-back-white header-master">
<br/>
<div className="">
<h1> Query Builder</h1><br/>
<Query
{...config}
//you can pass object here, see treeJSON at onChange …Run Code Online (Sandbox Code Playgroud) 我是 Reactjs 的新手,并开始学习它。我一直在尝试启动一个基本的 hello world 程序,但它在编译级别失败。使用 create-react-app hello-world 创建了一个启动 hello-word 程序,它给了我一个很好的文件夹结构,里面有一堆文件。在这里你可以看到编译错误
Failed to compile
./src/index.js
Module build failed: Error: Failed to load plugin import: Cannot find module
'eslint-plugin-import'
Referenced from:
at Array.forEach (native)
at Array.reduceRight (native)
This error occurred during the build time and cannot be dismissed.
Run Code Online (Sandbox Code Playgroud)
此处错误状态找不到模块,因此我尝试安装 eslint 插件导入、标准 .. 等,但仍然无法正常工作。下面是我的 webpack.config.dev.js
// @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in …Run Code Online (Sandbox Code Playgroud)