denar90/yii2-lazy-loading-module 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

denar90/yii2-lazy-loading-module

Composer 安装命令:

composer require denar90/yii2-lazy-loading-module

包简介

Yii2 module for content lazy loading

README 文档

README

Yii2 module for content lazy loading

Main features:

  • showing items mode. Probability to use both in backend and in frontend
  • flexible module configuration

Installation

The preferred way to install this extension is through composer.

  • Either run
php composer.phar require --prefer-dist "denar90/yii2-lazy-loading-module": "dev-master"

or add

"denar90/yii2-lazy-loading-module": "dev-master"

to the require section of your application's composer.json file.

  • Add a new module in modules section of your application's configuration file, for example:
'modules' => [
    'lazyloading' => [
		'class' => 'denar90\lazyloading\LazyLoading',
		'modelNamespace' => '\app\models\Items' \\ your model with items
	],
],

This configuration will show only list, without links on each item. Mode by default is 'list'.

  • Mode 'view' configurations, for example:
'modules' => [
    'lazyloading' => [
		'class' => 'denar90\lazyloading\LazyLoading',
		'modelNamespace' => '\app\models\Items', \\ your model with items
		'mode' => 'edit',
		'additionalLinks' => [
			'view' => [
				'controller' => 'yourController',
				'action' => 'yourViewAction'
			]
		]
	],
],
  • Mode 'edit' configurations, for example:
'modules' => [
    'lazyloading' => [
		'class' => 'denar90\lazyloading\LazyLoading',
		'modelNamespace' => '\app\models\Items', \\ your model with items
		'mode' => 'edit',
		'additionalLinks' => [
			'view' => [
				'controller' => 'yourController',
				'action' => 'yourViewAction'
			],
			'delete' => [
				'controller' => 'yourController',
				'action' => 'yourDeleteItemAction'
			]
		]
	],
],

Usage

In your action call module

For example:

...
 	public function actionIndex() {
		$lazyLoading = Yii::$app->getModule('lazyloading');
		return $lazyLoading->runAction('lazyloading/index');
	}
...

Also you should create method in your model for getting list of items. For example:

namespace app\models\Items;
...
 	public function getAllItems($limit = 10, $offset = 0) {
		return $this->find()->offset($offset)->limit($limit)->all();
	}
...

统计信息

  • 总下载量: 139
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-02