您能否建议使用 Backbone/Marionette 进行动态模型加载的解决方案,例如在无限滚动的情况下?
我的通用代码如下所示:
Drivers = new AppList.DriverCollection
Drivers.url = $('#drivers-url').text()
Drivers.fetch()
请求转到我的 django 后端:
def ajax_get_drivers(request):
drivers = Driver.objects.all()
data = []
for driver in drivers:
data.append({
'id': driver.pk,
'name': driver.name,
'phone': driver.phone
})
response = json.dumps(data)
return HttpResponse(response, mimetype="application/json")
如何在零件上打破它?