我使用“perPage”选项创建了我的组件,该选项接受一个数字并设置每页作品显示的限制......
public function defineProperties()
{
return [
'perPage' => [
'title' => 'Number os works per page',
'description' => 'How many works do you want to display per page?',
'default' => 9,
'validationPattern' => '^[0-9]+$',
'validationMessage' => 'Only numbers allowed'
],
'sortOrder' => [
'title' => 'Order of Works',
'description' => 'How do you want to order the actors',
'type' => 'dropdown',
'default' => 'newest',
],
];
}
使用 GET 实现效果很好......但是在我的项目中我需要在任何地方实现 AJAX,所以我需要通过 AJAX 加载页面,并且我需要知道在组件上设置的数字是什么......我怎么能得到这个数字?
//my layout code
function onOpenWorkList()
{
$this['works'] = Category::where('slug', input('slug'))->first();
$this['categories'] = Category::all();
$this['active_category'] = input('slug');
$this['perPage'] = ""; // HERE IS THE CODE
return [
'.home_categories' => $this->renderPartial('work_list_categories_post'),
'.container' => $this->renderPartial('work_list')
];
}