我正在使用Laravel 5.7
和VueJs 2.5.*
...
我为发票和供应商表进行了分页。我有一个创建发票表格,其中有用于选择供应商的下拉选项,我有20多个供应商,在进行分页之后,我在表格中看到我的下拉选项中只有10个供应商...我不知道如何解决此问题。
分页是这样的:
在HTML中
<!--PAGINATION FOR VENDORS TABLE -->
<pagination :data="ticketInvoices" @pagination-change-page="getResults"></pagination>
<!--PAGINATION FOR VENDORS TABLE -->
<pagination :data="vendors" @pagination-change-page="getResults"></pagination>
methods:{}
的两个分页
//METHOD FOR INVOICE
getResults(page = 1) {
axios.get("api/ticket-invoice?page=" + page).then(response => {
this.ticketInvoices = response.data;
});
},
//METHOD FOR VENDOR
getResults(page = 1) {
axios.get("api/vendor?page=" + page).then(response => {
this.vendors = response.data;
});
},
InvoiceController
和VendorController
/*Invoice Controller*/
class TicketInvoiceController extends Controller
{
public function index()
{
$ticketInvoices = TicketInvoice::orderBy('created_at', 'desc')->paginate(10);
return $ticketInvoices;
}
/*Invoice Controller*/
class VendorController extends Controller
{
public function index()
{
$vendor = Vendor::paginate(10);
return $vendor;
}