我正在使用Hugo KeepIt主题。据我了解,该配置是正确的。
但是,运行命令
import { connect } from 'react-redux';
import Order from '../../Components/Order/Order';
import axios from '../../axios-order';
import * as actions from '../../store/actions/index';
import Spinner from '../../Components/UI/Spinner/Spinner';
import WithErrorHandler from '../../hoc/withErrorHandler/withErrorHandler'
class Orders extends Component {
componentDidMount () {
this.props.onFetchOrders(this.props.token, this.props.userId);
}
render () {
let orders = <Spinner />;
if ( !this.props.loading ) {
orders = this.props.orders.map( order => (
<Order
key={order.id}
ingredients={order.ingredients}
price={order.price} />
) )
}
return (
<div>
{orders}
</div>
);
}
}
const mapStateToProps = state => {
return {
orders: state.order.orders,
loading: state.order.loading,
token: state.auth.token,
userId: state.auth.userId
};
};
const mapDispatchToProps = dispatch => {
return {
onFetchOrders: (token, userId) => dispatch( actions.fetchOrders(token, userId) )
};
};
export default connect(mapStateToProps,mapDispatchToProps)(WithErrorHandler(Orders,axios));
出现以下错误:
import React,{Component} from 'react';
import Modal from '../../Components/UI/Modal/Modal'
import Auxillary from '../Auxillary'
import Orders from '../../Containers/Orders/Orders';
const withErrorHandler = ( WrappedComponent, axios ) => {
return class extends Component {
state = {
error: null
}
componentWillMount () {
this.reqInterceptor = axios.interceptors.request.use( req => {
this.setState( { error: null } );
return req;
} );
this.resInterceptor = axios.interceptors.response.use( res => res, error => {
this.setState( { error: error } );
} );
}
componentWillUnmount () {
axios.interceptors.request.eject( this.reqInterceptor );
axios.interceptors.response.eject( this.resInterceptor );
}
errorConfirmedHandler = () => {
this.setState( { error: null } );
}
render () {
return (
<Auxillary>
<Modal
show={this.state.error}
modalClosed={this.errorConfirmedHandler}>
{this.state.error ? this.state.error.message : null}
</Modal>
<WrappedComponent {...this.props} />
</Auxillary>
);
}
}
}
export default withErrorHandler;
我必须手动创建每个文件。
谁能告诉我可能的原因和解决方案?
答案 0 :(得分:0)
根据设计,如果原型文件具有相同的名称,它们将覆盖主题的原型文件。因此,很可能是您的文件:
archetypes/default.md
正在覆盖您主题的文件,位于:
themes/KeepIt/archetypes/default.md
要解决此问题,您可以执行以下一项操作:
archetypes/default.md
文件;或themes/KeepIt/archetypes/default.md
的内容并将其粘贴到您的archetypes/default.md
文件中