我很难理解为什么在以下代码中没有调用var React = require ('react');
class Sidebar extends React.Component {
constructor(props) {
super(props);
this.state = { indexes: [ ] };
}
ComponentDidMount () {
console.log('mounted');
}
render () {
return (
<div className="sidebar">
<nav className="nav">
<ul>
{this.state.indexes.map((itm) => (
<li key={itm.id}><a href="#">{itm.name}</a></li>
))}
</ul>
</nav>
</div>
);
}
};
module.exports = Sidebar;
。
# Create your models here.
class WorkOrder(models.Model):
fk_client = models.ForeignKey(Client, verbose_name='Cliente')
fk_store = models.ForeignKey(Store, verbose_name='Local')
store_internal_order = models.CharField(verbose_name='Orden Interna',
max_length=10,
null=True,
blank=True)
sector = models.IntegerField(verbose_name='Sector',
choices=SECTOR_CHOICES,
default=1)
article = models.CharField(verbose_name='Dispositivo', max_length=20)
serial = models.CharField(verbose_name='Serial', max_length=25)
work = models.CharField(verbose_name='Trabajo', max_length=40)
article_details = models.CharField(verbose_name='Detalles Artículo',
max_length=255, blank=True)
cash_advance = models.DecimalField(verbose_name='Seña', max_digits=6,
decimal_places=2,
default=0)
initial_price = models.DecimalField(verbose_name='Precio', max_digits=6,
decimal_places=2,
default=0)
service_cost = models.DecimalField(verbose_name='Costo', max_digits=6,
decimal_places=2,
default=0)
randpassw = models.CharField(default='12345', max_length=5, blank=True,
null=True)
warranty = models.PositiveSmallIntegerField(verbose_name='Garantía',
default=0,
blank=True,
null=True)
last_status = models.IntegerField(verbose_name='Estado',
choices=STATUS_CHOICES,
default=1)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
def __str__(self):
return str(self.id)
我在这里遗漏了什么吗?
由于
答案 0 :(得分:4)
ComponentDidMount =&gt; componentDidMount?区分大小写